Last active
August 31, 2017 04:01
-
-
Save chasestarr/ce439e29bf3eb031c252bb25eadffe73 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<Username | |
handler={this.handler} // <---- 'handler' will be available from `props.handler` within the component | |
username={this.state.username} | |
/> | |
__________________________________ | |
class Username extends React.Component { | |
render() { | |
return ( | |
<input | |
name="username" | |
value={this.props.username} | |
onChange={this.props.handler} // <-- this is shorthand for `onChange={event => this.props.handler(event)}` | |
/> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment