4 ms·
This is a good article, but the title makes the wrong comparison: * Context is a dependency injection utility. * Redux is a state-management library. Redux do
by ncphillips 8y ago
This is a good article, but the title makes the wrong comparison:
* Context is a dependency injection utility.
* Redux is a state-management library.
Redux doesn't know anything about React. In order to use it with React you need to use ReactRedux, which actually uses Context to do it's thing.
The comparison being drawn with the article is still the old:
> React Redux vs React State.
The difference now is that React has a new (and substantially better) Context API.
- acemarke 8y agoYes, Redux by itself knows nothing about React. But, the vast majority of Redux users are using React, and it's a reasonable shorthand to just say "Redux" in this case. It's also how most end users would tend to refer to things. FYI, I'm a Redux maintainer. We are currently working on an internal refactoring of React-Redux's `connect` so that it will use the new `React.createContext` API instead of legacy context. We've got two open PRs with "competing" reimplementations, and I will actually be spending the rest of today hacking on those. The immediate goal is to make React-Redux at least compatible with React's upcoming "async rendering" capabilities. However, we do have some difficult problems to solve in order for Redux to take full advantage of the "Suspense" feature. We've got a decent idea what the problem space is, but we need some more examples and guidance from the React team so we can try to work on a solution. Side note: we're also hoping to completely rework the React-Redux docs (since they're mostly just a jargonistic API reference in a Markdown file in the repo), and we're also considering a restructuring / reworking of the core Redux docs as well. Would love to have some suggestions or even additional volunteers to help us! Issues/links for reference: - Roadmap: https://github.com/reduxjs/react-redux/issues/950 https://github.com/reduxjs/react-redux/issues/950 - v6 WIP PRs: https://github.com/reduxjs/react-redux/pull/995 https://github.com/reduxjs/react-redux/pull/995 , https://github.com/reduxjs/react-redux/pull/1000 https://github.com/reduxjs/react-redux/pull/1000 - React-Redux docs: https://github.com/reduxjs/react-redux/issues/1001 https://github.com/reduxjs/react-redux/issues/1001 - Redux core docs: https://github.com/reduxjs/redux/issues/2590 https://github.com/reduxjs/redux/issues/2590
- hajile 8y agoThe ReactReason devs seem to be averse to adding the context API (fears of instability). Does the Redux team have any similar reservations?
- acemarke 8y agoI haven't looked at ReactReason beyond seeing it mentioned in a few conference slides. The new context API (`React.createContext`) is intended to be stable going forward. As far as I know, the only potential "unstable" aspect remaining is the `changedBits` prop for potentially optimizing which consumers actually update on a given context value change. So no, I don't have any particular reservations at the moment. Legacy context still works but is very deprecated, and new context allows us to refactor the internals in a way that's ultimately simpler and hopefully more compatible with where React is going. Can you point me to some of these ReactReason discussions?
- hajile 8y agohttps://github.com/reasonml/reason-react/issues/199#issuecomment-404705135 https://github.com/reasonml/reason-react/issues/199#issuecom... It's one of the big reasons our company isn't even considering ReactReason at present. Lack of support for version 16 APIs is killer when you already have stuff depending on them.
- acemarke 8y agoHuh. I'm very surprised to see that comment coming from Cheng Lou. React 16.3 came out in March, and the React team has been encouraging everyone to use the new context API since then. Really not sure what's behind his comment.
- IggleSniggle 8y agoI live in an Angular world, and a lot of what you’re describing sounds like ideas that are common in many Angular setups, with async rendering of state not completing until a data stream holding state passes through an async pipe in the template/view. How much conversation is there with the ngrx (AngularRedux implementation with Redux as a leaf-able RxJS stream) folks? This is essentially an async integration, wondering if there is some good additional idea exchange to be had there.