v8.0.0-beta.0 #1843
Replies: 2 comments 4 replies
-
Just a couple of quick questions. I want to use React Redux and Redux toolkit in a personal project of mine but I'm a little confused as to go about this with new versions coming out all the time and compatibility. I want to use the latest version of everything and I don't care that it might break because it's a personal project. So... A) If I use React-Redux v8.0beta am I ok to use the latest version of react toolkit or do I need a newer beta version of that? Are they just totally separate products or do they rely on version matching? B) I'm using React 18 beta too and I've read something about no longer requiring memoized selectors, so do I need to change the way I write selectors with v8 as redux-toolkit uses ReSelect? Sorry for the dumb questions, I've only used react-toolkit in one simple project before. |
Beta Was this translation helpful? Give feedback.
-
I'm curious as a preact developer, would I have to use the compat entry point over just importing react-redux? |
Beta Was this translation helpful? Give feedback.
-
This beta release adds a new
'react-redux/compat'
entry point for use with React 16.9+ 17.x, re-enabling broader compatibility across React versions to make it easier to upgrade to React-Redux v8.While there are no other changes since the previous alphas (and there's really been very minimal feedback reported on the alphas thus far), we believe the v8 pre-releases are stable enough to begin seriously evaluating them as upgrades in your apps. This also aligns with React 18 being upgraded to beta status and the
useSyncExternalStore
API stabilizing.We would really appreciate users trying out this release with all compatible versions of React and reporting the results, even if it's just "yup, tried it and it works"! See the linked discussion thread.
Changelog
New "Compat" Entry point
In
8.0.0-alpha.0
, we switched the internals ofconnect
anduseSelector
to use the newuseSyncEternalStore
API from React. At the time, that was only available in the form of a "shim" package that worked with multiple React versions.In
8.0.0-alpha.1
,useSyncExternalStore
had been added to React itself. The original plan was always to make React-Redux v8 have a hard dependency on React 18, and the shim adds about 750 bytes to bundle size, so we dropped use of the shim entirely.After suggestions from the community, we've now added a new
'react-redux/compat'
entry point that falls back to using the shim. This should enable React-Redux v8 to work correctly with earlier versions of React that support hooks (16.9+ and 17.x), as well as Preact (which does not appear to be implementinguseSyncExternalStore
at this time).We've updated our test suite to run all tests against both React 18 and the standard entry point with no
uSES
shim, and React 17 and the "compat" entry point with theuSES
shim, and all tests are passing.The likely approach for using this would be to alias or override your build setup to redirect imports of
'react-redux'
to the'react-redux/compat'
entry point instead.What's Changed
v8.0.0-alpha.1...v8.0.0-beta.0
This discussion was created from the release v8.0.0-beta.0.
Beta Was this translation helpful? Give feedback.
All reactions