v0.6.0
This release should make your connect()
ed components render faster.
Breaking Changes
The components generated by connect()
no longer redraw if you deeply mutate their props. Redux embraces immutability, and deep mutations of state never caused redraws anyway, so it's reasonable to fully embrace it, and do the same for props.
Now this:
handleClick() {
this.state.obj.something = 'changed';
this.setState({ obj: this.state.obj });
}
render() {
return <ConnectedComponent obj={this.state.obj} />
}
will not redraw if ConnectedComponent
is something you got from React Redux's connect()
.
If you use this pattern in your code, change it to always create new objects:
handleClick() {
this.setState({ obj: Object.assign({}, this.state.obj, { something: 'changed' }) });
}
render() {
return <ConnectedComponent obj={this.state.obj} />
}
Why
This lets us be very efficient with state updates. Even if you supply a custom mergeProps
function, we'll only update the connected component if the object it returns is shallowly unequal to the stored one.