React drop-down box after selecting a value, how to reset (the Ant Design) used

how to reset

after selecting a value in the drop-down box
this.state({
    code: "",
    codeList: "",
})

componentWillMount(){
   init(); //
}

<Select
    ref="xzSelect"
    defaultValue=""
    onSelect={val => this.setState({code:val})}
>
    {this.state.codeList}
</Select>
Feb.27,2021

two ideas

1. Load a new Select when you need to reset, and you can use the key value to forcibly refresh

.

2. Make it a controlled component, manually control value of Select , and change the selected option

with onSelect .
<Select
    ref="xzSelect"
    placeholder=""
    value={this.state.val}
    allowclear
    onChange={val => this.setState({code:val})}
>
    {this.state.codeList}
</Select>

you just need to make the component controllable.
, which is the method upstairs, add value and onChange

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be6de0-30fac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be6de0-30fac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?