I have a component using react-select, I get the options from props, on selct option I want to rerender the select with other options - it works, but onChange not triggered.
import Select from 'react-select';
onChange(option){
dispatch(updateOptions());
}
render(){
return
<Select
options={this.props.options}
onChange={this.onChange}
value={this.state.text}
menuIsOpen
/>
}
Please have a look at this example, I have created two components one as a Functional Component
and the other as Class Component
.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With