Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Final ConnectState
class ConnectState extends React.Component {
state = {};
static getDerivedStateFromProps ({ state, mapState = s => s }) {
return mapState(state);
shouldComponentUpdate (nextProps, nextState) {
return shallowCompare(this.state, nextState);
render () {
return this.props.children({
state: this.state,
dispatch: this.props.mapDispatch ? this.props.mapDispatch(this.props.dispatch) : this.props.dispatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.