|
|
|
|
|
by reboog711
1682 days ago
|
|
> But the way react deals with state makes it so much easier to build and maintain complex applications. Real question; not being snippy... I didn't think React had any state management included. A lot of people I've spoken to seem to use Redux, a third party library for handling state. Is my understanding incorrect? |
|
However, that _is_ limited in that you can only access state inside the current component, or pass it down the tree as props/context. If you need to access data broadly across the component tree, or the data itself does not lend itself to a tree-shaped usage pattern, or you need to minimize the number of components that re-render when you update, or you need to use it _outside_ the component tree, then you may want to look at an external state management library.
I've talked about the tradeoffs in these approaches numerous times:
https://blog.isquaredsoftware.com/2021/01/context-redux-diff...
https://changelog.com/posts/when-and-when-not-to-reach-for-r...
https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-...
All that said: React makes writing an application with any meaningful amount of complexity _vastly_ easier to do than trying to do it with either preceding UI frameworks (AngularJS 1.x, Backbone, etc) or jQuery. It isn't perfect, but it's well-suited for a wide range of application development use cases.