I've tried to follow to online tutorial on how to update a state when using React Hooks. Somehow the code is working but the IDE (WebStorm) is complaining about it.
Essentially, what I am trying to accomplish is to only update one of the variables inside the object that I define in the useState. Oh, I am using JavaScript and not TypeScript.
For example:
const[test, setTest] = useState({isvalid:false, isCommon:false});
...
function validate(){
setTest((prevState) =>({...prevState, isValid:true}))
}
In the IDE I am getting:
Argument type function(any) & {isValid: boolean} is not assignable to parameter type...