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.
Changelog
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
- add an extra entrypoint for React Server Components by @phryneas in #2062
- Inline hoist-non-react-statics to eliminate a dep and help shaking by @markerikson in #2066
- Make context typing more accurate by @EskiMojo14 in #2041
Full Changelog: v9.0.0-alpha.0...v9.0.0-alpha.1