Im trying to add multiple values inside my defaultValue attribute but without success.
<Select
value={this.state.selectedTests}
defaultValue={this.getDefaultValues(this.props.tests)}
isMulti onChange={(e) => this.handleChange(e)}
options={this.state.allTests}
className="basic-multi-select dropDownSelector"
/>
getDefaultValues() returns an array:
0:{value: "t1", label:"Test1"}
1:{value: "t2", label:"Test2"}
But the Select element shows no labels...
Anyone else faced the same issue or knows how to solve this?
Thank you for your help!
I solved my problem :) The values in the attribute "value" overwrote the values in the attribute "defaultValue". I delete the attribute "value" and it works now.
Changed code:
<Select
defaultValue={this.getDefaultValues(this.props.tests)}
isMulti onChange={(e) => this.handleChange(e)}
options={this.state.allTests}
className="basic-multi-select dropDownSelector"
/>
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