by archarios · 7y ago · 0 comments
https://blog.isquaredsoftware.com/2018/03/redux-not-dead-yet...
Also, Dave Ceddia wrote a good post comparing Redux and the context API:
https://daveceddia.com/context-api-vs-redux/
FWIW, my rough stats indicate that somewhere around half of all React apps use Redux, and Redux is also used with other UI frameworks as well. Redux definitely isn't going away any time soon :)
That is because context was never intended as a replacement for Redux or any other state management library. In fact Redux itself uses context under the hood.
Context is more of a low level api. Somewhat similar to TCP/IP. You never work with TCP/IP directly but use high level abstractions like HTTP that work on top of TCP/IP and provide a simple interface.
Personally, I find for mid-large apps that Redux is usually a better approach. For small-mid, you're likely better off using the new context directly. Also don't forget you can maintain in-component state.
React Context makes a lot of sense though, because you'll effectively be able to create your own Redux nested at any level in the DOM. This means local state will be much easier to manage and you won't have the issue of having to stuff all your disparate contextual data into one shared store.
While with Redux, not that I am bitching about it, it first states that I need to accept several principles before I can better appreciate it. Then here comes all the middlewares, like redux-saga/redux-thunk and the list goes on. As a causal, meaning I am not writing js fulltime but do use it in some non-trivial situtation when needed, I feel it quite heavy and burdensome, making hesitant to adopt it unless being asked to.