Skip to content

Instantly share code, notes, and snippets.

@pokorson
Created August 3, 2017 11:25
Show Gist options
  • Save pokorson/f94f76c2800364f998a5f18e2f1087b5 to your computer and use it in GitHub Desktop.
Save pokorson/f94f76c2800364f998a5f18e2f1087b5 to your computer and use it in GitHub Desktop.
class ParentComponent extends React.Component {
handleChange(val) {
this.setState({val: val})
}
render() {
<Select onChange={handleChange} />
}
}
class Select extends React.Component {
handleClick() {
this.props.onChange(this.state.value);
}
render() {
<div>
<span onClick={this.handleClick}></span>
<span></span>
<span></span>
</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment