3 ms·
I think you should generally start by putting everything into Component state, and only move stuff to the store if you find yourself needing to do a lot of prop
by fastball 9y ago
I think you should generally start by putting everything into Component state, and only move stuff to the store if you find yourself needing to do a lot of prop-drilling.
Time travel is nice, but it is not worth putting everything into your Redux store.
- mephitix 9y agoBut if you want to do prop-drilling then the advice from the React team is that Redux shouldn’t be used just for that. (Context API is the suggested approach). FTA: “If you're only using Redux to avoid passing down props, context could replace Redux - but then you probably didn't need Redux in the first place” I use Redux sort of like Core Data (in iOS world) - I just use it mostly to store external data since it’s valuable to track the modifications to and morph (via reselect) specifically that kind of data. If I ever have other local state it just sits in components. But most of the time components have no state at all.
- fastball 9y agoYeah, sorry, I wasn't clear. My point was mostly that you shouldn't be afraid to let state live in Components and that should be your first instinct even if you are already using Redux for any one of its benefits. There are other reasons besides prop-drilling to offload state into the store, but don't do it if your only reason is "I want to make debugging marginally easier".