Skip to content

Instantly share code, notes, and snippets.

@agutoli
Last active January 23, 2019 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agutoli/5c5bdc43e678cba0016e341148b98a23 to your computer and use it in GitHub Desktop.
Save agutoli/5c5bdc43e678cba0016e341148b98a23 to your computer and use it in GitHub Desktop.
class SelectWrapper extends React.Component {
constructor(props){
super(props)
this.state = {
options: [
{value: "old", label: "Old value"}
]
}
}
getOptions(selectedValue) {
setTimeout(() => {
this.setState({
options: [
{value: "new", label: "New value"}
]
})
}, 1000)
}
onChangeOptions = (selectedValue) => {
this.getOptions(selectedValue)
}
render() {
return (
<Select
options={this.state.options}
onValueClick={this.onChangeOptions}
/>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment