4 ms·
What I'm really missing here is the "When not to use Redux" part. Can somebody help with that? So far I've been using context only and it was fine. Why should I
by edem 6y ago
What I'm really missing here is the "When not to use Redux" part. Can somebody help with that? So far I've been using context only and it was fine. Why should I switch to Redux?
- acemarke 6y agoThat's actually covered directly in the linked tutorial page [0], as well as in our Redux FAQ section [1] Note that one of the weaknesses of the React context API is that it currently has significant limitations in how components using it re-render, because you can't bail out of re-renders caused by context or only selectively depend on certain pieces of a context value. In contrast, React-Redux lets you select specific pieces of data from the Redux store, and your components only re-render when the data they need changes. For more details, see my extensive post "A (Mostly) Complete Guide to React Rendering Behavior" [2]. My post "Redux - Not Dead Yet!" [3] also addresses some of the differences in use cases for Redux and Context, and how they're very different tools that solve different problems. [0] https://redux.js.org/tutorials/essentials/part-1-overview-concepts#when-should-i-use-redux https://redux.js.org/tutorials/essentials/part-1-overview-co... [1] https://redux.js.org/faq/general#when-should-i-use-redux https://redux.js.org/faq/general#when-should-i-use-redux [2] https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/ https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-... [3] https://blog.isquaredsoftware.com/2018/03/redux-not-dead-yet/ https://blog.isquaredsoftware.com/2018/03/redux-not-dead-yet...
- avtar 6y agoI'm unable to make a PR at the moment but the first linked page https://redux.js.org/tutorials/essentials/part-1-overview-concepts#when-should-i-use-redux https://redux.js.org/tutorials/essentials/part-1-overview-co... has a broken link https://redux.js.org/tutorials/faq/General.md#when-should-i-use-redux https://redux.js.org/tutorials/faq/General.md#when-should-i-... I'm assuming the correct link was supposed to be https://redux.js.org/faq/general#when-should-i-use-redux https://redux.js.org/faq/general#when-should-i-use-redux
- acemarke 6y agoThanks, I'd missed a relative path for that link. Just pushed a fix.
- lioeters 6y agoThere are articles on this topic of when not to use Redux - for example: You might not need Redux - https://dev.to/jaffparker/you-might-not-need-redux-k4e https://dev.to/jaffparker/you-might-not-need-redux-k4e Personally, I learned Redux, then as soon as possible found different (simpler) ways to achieve the same pattern. I love the concepts of Redux, but not the boilerplate (nor the ecosystem, if I'm being honest).