Created
January 17, 2018 15:44
-
-
Save loganpowell/cbaca04a07a83d122b20aef234dbab01 to your computer and use it in GitHub Desktop.
State Hoisting in React (Child to Parent communication)
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
//from: https://reactpatterns.com/#event-switch | |
class NameContainer extends React.Component { | |
constructor() { | |
super() | |
this.state = {name: ""} | |
} | |
render() { | |
return <Name onChange={newName => this.setState({name: newName})} /> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment