This release drops our dependency on the core
redux package by inlining
bindActionCreators, and tweaks
useSelector to ensure that selectors aren't run an extra time while re-rendering.
Redux Dependency Removal
React-Redux has always imported the
bindActionCreators utility from the core
redux package for use in
connect. However, that meant that we had to have a peer dependency on
redux, and this was the only reason we actually required that
redux be installed. This became more annoying with the arrival of Redux Toolkit, which has its own dependency on
redux internally, and thus users typically saw peer dependency warnings saying that "
redux isn't listed as a dependency in your app".
Code reuse across separate packages is a great thing, but sometimes the right thing to do is duplicate code. So, we've inlined
bindActionCreators directly into React-Redux, and we've completely dropped the dependency on Redux. This means that React-Redux will no longer produce a peerDep warning when used with Redux Toolkit, and
connect really only need a Redux-store-compatible value to work right.
Users reported that
useSelector was re-running selector functions again unnecessarily while rendering after a dispatch. We've tweaked the logic to ensure that doesn't happen.
useSelector also now has checks in development to ensure that
equalityFn are functions.
- Remove wrapActionCreators (#1709 - @xty)
- Verify that selector and equalityF of useSelector are functions (#1706 - @gshilin)
- Import bindActionCreators from redux (#1705 - @timdorr)
- Don't re-run the selector after update (#1701 - @timdorr)