I have been reading some redux tutorials and to be honest I do not see up until now what added value it brings over plain react.
As far as I know I can build an app and manage its state using only react, so, what makes redux something worth using?
Well, I do recognize redux has a few advantages over react, namely:
But maybe due to my lack of experience building large apps I am not convinced that it would make my life easier.
Can you elaborate a little more on the advantages of using redux over plain react?
While it's certainly possible for each of these to become a performance concern in sufficiently complex situations, there's nothing inherently slow or inefficient about how Redux is implemented.
Using Redux also means learning how it works, which again could be a waste of time if you don't need it. As a rule of thumb - and one shared by one of Redux's creators, Dan Abramov - you don't need to use Redux unless you're unable to manage state within React or other front-end frameworks you're working with.
Redux can be used with React. both are independent of each other. Redux is a state managing library used in JavaScript apps. It simply manages the state of your application or in other words, it is used to manage the data of the application.
Off the top of my head, a few advantages:
And that's before getting to many of the commonly discussed benefits, such as predictable state updates, time travel debugging, improved testability, and centralized logic.
It's certainly true that you can write an entire application using nothing but React's component state (and Dan Abramov himself says that people often jump into Redux too early), but from my perspective Redux is absolutely worth it.
edit
I've written up an expanded version of this answer as an article on the Full Stack React site: Redux and Why It's Good For You.
To me, the biggest advantage is the fact that redux
has a single state tree compared to possibly many smaller states in react
only components. Together with redux
' reducers, state becomes very deterministic and is easier to reason about.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With