Last active
December 16, 2018 22:02
-
-
Save Jahans3/0e61c2a960be5a39038c30ab0baea7a9 to your computer and use it in GitHub Desktop.
Updating our state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class StateProvider extends Component { | |
static defaultProps = { | |
state: {} | |
}; | |
state = this.props.state; | |
render () { | |
return ( | |
<Provider value={{ state: this.state, setState: this.setState.bind(this) }}> | |
{this.props.children} | |
</Provider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment