I'm trying to change state onChange in Dropdown Component
const DropdownDomainSelection = () => (
<Dropdown placeholder='Select Friend' selection options={domainsList} onChange={this.handleDomainsSelectChange} />
)
handleDomainsSelectChange = (e, data) => {
this.setState({
currantDomain_id: data.value,
currantWidget_id: "null",
}, () => {
console.log('this.state.currantDomain_id',this.state.currantDomain_id);
});
}
The state changes fine. Problem is that Dropdown's value always returns to default 'Select Friend'.
How can I make Dropdown change it's state to selected item?
The Dropdown component is missing a value prop. The value prop controls the current value of Dropdown. Just add the prop value = {this.state.currantDomain_id}
to it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.