when the select value is equal to the first select = 'please select' i want to disable the button and enable it the inverse when i select.
const [isDisabled, setDisabled] = useState(true);
const handleChangeButton =() => {
setDisabled(false);
}
const getctg2 = (val) => {
if (val !="please select "){
handleChangeButton();
}
}
the error msg that i have is : Error: Too many re-renders. React limits the number of renders to prevent an infinite loop.
Try this way