3 ms·
I don't get why most projects need Redux when React has the context API already. Most people just need a place to store data shared across different components,
by presentation 4y ago
I don't get why most projects need Redux when React has the context API already. Most people just need a place to store data shared across different components, and plain contexts do that easily.
- skydhash 4y agoThey can, but for any reasonable sized application, you're basically recreating bare redux. If someone is good with both, it can architect and choses the correct one based on the needs of your software. But if you find that your global state needs are not small, you just chose redux - add a library like rematch on top to reduce boilerplate - so it's straightforward for your junior.
- acemarke 4y agoOut of curiosity, any particular reason you'd suggest Rematch instead of our official Redux Toolkit package? If you're familiar with both already, are there any parts of Rematch's API you prefer over RTK's, that we should consider looking at for inspiration?
- acemarke 4y agoBecause Redux and Context are different tools that solve different problems, with some overlap. Context is a Dependency Injection tool for a single value. Note that it doesn't "manage" or "store" anything - it's just a tube that you can pass something through. Any actual "storage" is normally done with React's own `useState/useReducer` hooks, which actually _do_ store and update values. Redux, meanwhile, is a tool for predictable state management outside React. Very different kind of tool, for a different purpose. More details: https://blog.isquaredsoftware.com/2021/01/context-redux-differences/ https://blog.isquaredsoftware.com/2021/01/context-redux-diff...
- deleted 4y ago[deleted]
- jokethrowaway 4y agobecause context re-renders everything all the time