This beta release switches the default entry point to use the useSyncExternalStore
shim for compatibility with React 16.8+, and switches to a "/next"
alternate entry point without the shim.
At this point, React-Redux v8 is feature-complete and stable. We still really want users to try this out and give us feedback before the final release! We'd also like to add some additional tests around SSR behavior.
We would like to release v8 as final within the next couple weeks now that React 18 is available.
Changelog
useSyncExternalStore
Shim Usage
React 18 adds the new useSyncExternalStore
API. In previous betas, the plan was that React-Redux v8 would have a hard requirement on React 18. As a fallback, the betas provided a "/compat"
entry point that included the uSES
"shim", a userland implementation from the React team that provided compatibility with earlier React versions back to 16.8. That adds a few hundred bytes to the bundle size, so we wanted to keep the default size smaller.
However, React Native will not support React 18 until the "New Architecture" is done. So, release React-Redux v8 with a hard React 18 requirement would immediately start breaking RN usage.
After discussion with the React team, we've flipped the default behavior in v8. Now, the default entry point does rely on the uSES
shim. This increases final bundle size slightly (about 600b minified compared to v7.x). However, this ensures that React-Redux v8 is compatible with React 16.8+/17 out of the box, enabling users to upgrade to v8 right away even if they aren't using React 18. It also ensures continued RN compatibility.
For users who would like to strip out the shim, this release switches to having a "/next"
entry point that directly imports useSyncExternalStore
from React, with no shim. You can alias "react-redux": "react-redux/next"
in your bundler to use that instead.
What's Changed
- Remove unused useCallback import by @bobaekang in #1883
- Swap
useSyncExternalStore
shim behavior and update React deps by @markerikson in #1884
Full Changelog: v8.0.0-beta.3...v8.0.0-beta.4