DEV Community

davidka7
davidka7

Posted on

Why use Redux?

Well for first it helps you manage your state better, its actually quite a handy tool. What it does is gather all your state data of your application, saves it to a store, and then you can easily access it from any component.
Now you might think it is not helpful or not needed. But as your application gets bigger, managing state becomes a lot harder and annoying.
I use react overall, and so I will be using it for this example. In react a state is managed inside a parent component, and you can pass it through sibling components as prop. And so you see that managing state gets messy, and this is why you need a tool like redux.
How does redux work? It has three main section to it. The first is action, this is how you send your data to the redux store. Then you have the reducers, that take the state and perform some action to that state and then return it. And last we have the store which holds all the state stored. With redux there is one store and all components have access to it. It also makes it a lot easier to test it and debug it.

Top comments (0)