🐛 Adding a commentary
This commit is contained in:
parent
53b2adc892
commit
740a523fad
@ -75,9 +75,12 @@ export default class MultiSelect extends React.Component<IProps, IState> {
|
||||
|
||||
public override componentDidMount(): void {
|
||||
if (this.props.defaultValue) {
|
||||
// If default value contains multiple IOptions
|
||||
if (Array.isArray(this.props.defaultValue)) {
|
||||
this.setState({ selectedOptions: this.props.defaultValue });
|
||||
}
|
||||
|
||||
// If default value is a single IOption
|
||||
if ("label" in this.props.defaultValue) {
|
||||
this.setState({ selectedOptions: [this.props.defaultValue] });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user