Reputation: 122
Here is full demo what i want to say..
when I select android than it gives options of android and when I change option to apple than old option already select how can I unselect them. Any idea ?
Upvotes: 1
Views: 481
Reputation: 834
You can keep the values of the inner selects in a variables, and reset them when the outer select changes.
const [left, setLeft] = useState();
const [right, setRight] = useState();
and then, use this values like this:
<Select
placeholder="Minimum OS version"
options={
selectedPlatform === "IOS" ? iosVersions : androidVersions
}
onChange={(e: any) => setLeft(e)}
value={left}
/>
and in the onChange of the outer select do:
setLeft(null);
setRight(null);
Upvotes: 1