En caso de selección múltiple, ¿alguien puede ayudarme con la función onChange?
¿Qué puedo pasar dentro updateFormState( ) para que el código funcione? Gracias.
const formState = { fruits: "", }; function updateFormState(key, value) { formState[key] = value; } const [fruits] = useState([]); <Form.Label>fruits</Form.Label> <MultiSelect options={[ { label: "Grapes 🍇", value: "grapes" }, { label: "Mango 🥭", value: "mango" }, { label: "Strawberry 🍓", value: "strawberry", disabled: true }, ]} id="fruits" labelledBy="Select" value={fruits} onChange={(e) => updateFormState( )} /> </Form.Group>hola prueba esto espero que te sirva
const [fruits, setFruits] = useState(); console.log("fruits",fruits); return ( <div> <select onChange={(e) => setFruits(e.target.value)} value={fruits}> <option value='' selected disabled hidden> select a fruits </option> <option value='apple'>apple</option> <option value='banana'>banana</option> <option value='orange'>orange</option> </select> </div> );