how to relate two Selects? #4772
Unanswered
FrancoPaez
asked this question in
Q&A
Replies: 1 comment
-
@FrancoPaez Your going to want to use state to store your selections so that you can check state to see if anything is selected. Example: const [state, setState] = useState({
areaSelect: [],
subAreaSelect: []
})
const handleSelect = (value, action) => {
setState( ...state, [action.name]: value })
}
return (
<Select
name={'areaSelect'}
value={state.areaSelect}
options={yourOptions}
onChange={(value, action) => handleSelect(value, action)}
/>
<Select
name={'subAreaSelect'}
value={state.subAreaSelect}
options={yourOptions}
onChange={(value, action) => handleSelect(value, action)}
isDisabled={!state.areaSelect.length}
/>
) You'll see that I am checking the state array |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Could you give me a hand with this? I have to enable a Select react only if the previous one was already used, but I don't really understand the methods as the documentation shows them
Thank you
Beta Was this translation helpful? Give feedback.
All reactions