Skip to content

Instantly share code, notes, and snippets.

@chasestarr
Last active August 31, 2017 04:01
Show Gist options
  • Save chasestarr/ce439e29bf3eb031c252bb25eadffe73 to your computer and use it in GitHub Desktop.
Save chasestarr/ce439e29bf3eb031c252bb25eadffe73 to your computer and use it in GitHub Desktop.
<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