Created
February 16, 2019 12:10
-
-
Save motionrus/36a969849046c5558a64c4641152d545 to your computer and use it in GitHub Desktop.
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
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