I have just started using hooks and I got the above warning when i was calling useEffect inside a function:
Then I have to move the useEffect outside of the function as belows:
const onChangeRetypePassword = async value => {
await setRePassword(value);
//previously useEffect was here
};
//useEffect outside of func
useEffect(() => {
if (password !== rePassword) {
setPasswdMismatch(true);
}
else{
setPasswdMismatch(false);
}
}, [rePassword]);
Hope it will be helpful to someone !