npm react-redux 9.0.0-alpha.1

latest releases: 9.0.0-rc.0, 9.0.0-beta.0, 8.1.3...
3 months ago

This alpha release adds an extra entry point that will automatically throw errors when any API is used in a React Server Components environment, inlines the hoist-non-react-statics dep, and updates context types.


React Server Components Behavior

Per Mark's post "My Experience Modernizing Packages to ESM", one of the recent pain points has been the rollout of React Server Components and the limits the Next.js + React teams have added to RSCs. We see many users try to import and use React-Redux APIs in React Server Component files, then get confused why things aren't working right.

To address that, we've added a new entry point with a "react-server" condition. Every export in that file will throw an error as soon as it's called, to help catch this mistake earlier.

hoist-non-react-statics Dep Inlined

Higher Order Components have been discouraged in the React ecosystem over the last few years. However, we still include the connect API. It's now in maintenance mode and not in active development.

As described in the React legacy docs on HOCs, one quirk of HOCs is needing to copy over static methods to the wrapper component. The hoist-non-react-statics package has been the standard tool to do that.

We've inlined a copy of hoist-non-react-statics and removed the package dep, with the hope that this will ensure better tree-shaking in some projects.

Context Type Updates

We've made some tweaks to our ReactReduxContextValue type to better reflect actual behavior.

What's Changed

Full Changelog: v9.0.0-alpha.0...v9.0.0-alpha.1

Don't miss a new react-redux release

NewReleases is sending notifications on new releases.