3 ms·
Point 1 in this article is totally misguided. "State management is how you mitigate prop drilling" implies that when prop drilling is not a problem (i.e. most o
by brlewis 7y ago
Point 1 in this article is totally misguided. "State management is how you mitigate prop drilling" implies that when prop drilling is not a problem (i.e. most of the time), that you don't need to think about state management. Even if you're prop drilling, you need to make sure data is not stored/updated in multiple places in your app in order to keep the UI consistent.
The one redeeming part of that section of this article is that it links to another article that isn't as wrong. The linked article details when prop drilling is and isn't a problem. And most of the problems it describes can be reduced by using TypeScript. https://kentcdodds.com/blog/prop-drilling https://kentcdodds.com/blog/prop-drilling
- brlewis 7y agoIn fact, the linked article is useful because it links to a much better article on state management with React: https://kentcdodds.com/blog/application-state-management-with-react https://kentcdodds.com/blog/application-state-management-wit...
- veeralpatel979 7y agoHey - author here. I did not mean to imply that state management is only useful to mitigate the prop drilling problem. In fact, in #2, I give another example where state management is useful.
- brlewis 7y agoThe first section reads as if it's explaining why state management is needed at all, not as if it's giving one example of something state management is good for. I couldn't make sense of the second section either. It sounds like it's recommending a global store as the solution to updating a single component. The correct state management for a single component is what comes with React.