v4.0.0
Breaking Changes
React 0.14 is now required and a peer dependency
If you need 0.13 support, keep using 3.x. In addition, React has now been promoted to be a peer dependency because you’ll use the same react
package for web and native.
react-redux/native
entry point has been removed
Track this React Native issue and wait until RN works on top of React 0.14. Then React Redux 4.x should “just work” in React Native. Until then, you need to keep using 3.x with React Native.
<Provider>
no longer accepts a function child
This resolves a ton of router-related issues and also helps beginners understand what's going on.
Before
React.render(
<Provider>
{() => <App />}
</Provider>,
rootEl
);
After
ReactDOM.render(
<Provider>
<App />
</Provider>,
rootEl
);
Refs are now opt-in
connect()
no longer provides a ref to the wrapped component by default. You need to specify withRef: true
in the options
as the fourth argument to connect()
to get the old behavior. getWrappedInstance()
will throw unless you do that.
This fixes #141.
Before
class MyComponent extends Component { ... }
MyComponent = connect(mapStateToProps)(MyComponent);
// later
let instance = React.render(<MyComponent />, targetEl);
console.log(instance.getWrappedInstance());
After
class MyComponent extends Component { ... }
MyComponent = connect(mapStateToProps, null, null, { withRef: true })(MyComponent);
// later
let instance = ReactDOM.render(<MyComponent />, targetEl);
console.log(instance.getWrappedInstance());