4 ms·
Check out React context to avoid this property passing, which is annoying, I agree. Did you know that Redux is now basically built into React? https://medium.
by tiborsaas 6y ago
Check out React context to avoid this property passing, which is annoying, I agree.
Did you know that Redux is now basically built into React?
https://medium.com/simply/state-management-with-react-hooks-and-context-api-at-10-lines-of-code-baf6be8302c https://medium.com/simply/state-management-with-react-hooks-...
https://blog.logrocket.com/use-hooks-and-context-not-react-and-redux/ https://blog.logrocket.com/use-hooks-and-context-not-react-a...
- satvikpendem 6y agoIn contrast, https://www.simplethread.com/cant-replace-redux-with-hooks/ https://www.simplethread.com/cant-replace-redux-with-hooks/ https://daveceddia.com/context-api-vs-redux/ https://daveceddia.com/context-api-vs-redux/ https://medium.com/javascript-scene/do-react-hooks-replace-redux-210bab340672 https://medium.com/javascript-scene/do-react-hooks-replace-r... TL;DR Context can replace some but not all of Redux. Redux can figure out which components to rerender based on what's being computed. Context doesn't, so it's basically the same as refreshing your entire component tree every time something changes. You could build it yourself, but at that point, you're just reinventing Redux. I also like the Redux Toolkit (https://redux-toolkit.js.org/ https://redux-toolkit.js.org/) which is an opinionated way to write Redux that cuts down the boilerplate a lot. createSlice is easily one of the best features, you can encapsulate Redux logic for each different type of content, like authentication, users, posts, etc.
- acemarke 6y agoGlad to hear that RTK is working well for you! I'm currently working on updating the Redux core docs to teach RTK as the default way to use Redux. Hoping to have the new "Quick Start" tutorial page up in the near future.