I mapped option select data from the Api but i have problem to change value of select input i use this handler change but the input can't change value is always fix what is the error in my code? how can i change the input value My error is like this is look please in the link video
https://github.com/JedWatson/react-select/issues/796
All the code in the same component
initialValues
const initialStates = {
rug: {nom: "", id: "" }
}
const [currentStates, setCurrentStates] = useState(initialStates);
handle change methode
const handleChange = event =>{
setCurrentStates({ ...rugList[event.target.value].drug.id });
};
Select input
<Form.Group as={Col} controlId="formGridDrug">
<Form.Label> Select</Form.Label>
<Form.Control required as="select"
type="text"
id="rug.id"
name="rug.id"
value={currentStates.rug.id}
className={"bg-white text-dark"}
onChange={handleChange}
>
<option value="">Choice select</option>
{rugList.map((value) =>
<option value={value.id} key={value.id}>
{value.nom}
</option>
)}
</Form.Control>
</Form.Group>
initialStatesinitialized - is it outside this component?react-selectrepo but it doesn't seem that you are using this library