Last active
January 23, 2019 11:56
-
-
Save agutoli/5c5bdc43e678cba0016e341148b98a23 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 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