What is Redux and why is it important in JS?
Hello, I often see people use the term "Redux" often in JS, can someone explain what it is and why is it important please.
17 Replies
Redux - A JS library for predictable and maintainable global state ...
A JS library for predictable and maintainable global state management
yeah I did have a look :c, it's still a bit unclear though, basically it's just a way where we store our variables, in a global object?
It's a library for global state management. Personally I haven't used anything besides context that comes with react so I can't tell you much
But it probably makes it easier to manage global state (note I said global) than vanilla react
Have you done a project yet that requires global states
That might make it easier to understand since you would know the problem
ah ok
no not yet, I only use local state, like, one .jsx file = 1 state, global state we mean multiple .jsx file sharing states?
Global state means state that your whole application uses.
yeah I see
User theme is an example, you store the light or dark theme as state
yeah we would use that across multiple thing, so it's a global state
And then all components might use that to know which theme to follow
yepp I see, make sense now, thanks !
Someone who has used redux or any other state management lib would probably have better insight in this. This is just what i understand
I have an overview of what it is now, thanks !!
Redux or any other state management libs provide an opinionated way of handling data flow that delegate the design decision to it's author (you can achieve this with React useContext), meaning developers don't have to spend their time thinking how should they design a data flow for their app but use an existed solution instead.
Signals ❤️
Wont do you any good in React but everyother framework has signals now
oh didn't heard of that
how do signals work? it's the same thing in the sense we use it for global state?
Pretty much
yep I see