Skip to content

Instantly share code, notes, and snippets.

@motionrus
Created February 16, 2019 12:10
Show Gist options
  • Save motionrus/36a969849046c5558a64c4641152d545 to your computer and use it in GitHub Desktop.
Save motionrus/36a969849046c5558a64c4641152d545 to your computer and use it in GitHub Desktop.
class App extends Component {
state = {
selected: null
}
handleChange = (selected) => this.setState({selected})
getUserState = (state) => {
console.log('---', state)
}
render() {
const options = articles.map((article) => ({
label: article.title,
value: article.id
}))
return (
<div>
<h1>Article App</h1>
<UserForm onStateChange={this.getUserState} />
<Select options={options} value={this.state.selected} onChange={this.handleChange} />
<ArticleList articles={articles} />
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment