I am using MultiSelect inside a form and wanted to set the formState with the selected values using onChange.
At present, the below code passes the default null value for permission_sets on form submit.
Can someone take a look and let me know how to update the value of permission_sets inside formState from onChange on dropdown selections. This will pass the actual selected values on the form Submit.
const formState = {
permission_sets: "",
}
function updateFormState(key, value) {
formState[key] = value;
}
function App() {
const [permission_sets, set_permission_sets] = useState([]);
return (
<Form.Group>
<Form.Label>permission_sets</Form.Label>
<MultiSelect
options={[
{ label: "Operations", value: "Operations" },
{ label: "ReadOnlyAccess", value: "ReadOnlyAccess" },
{ label: "Dba", value: "Dba"},
]}
id="permission_sets"
labelledBy="Select"
value={permission_sets}
onChange={set_permission_sets}
/>
</Form.Group>
<Button onClick={validate}>Submit Request</Button>
)}