useEffect error
PoovendhanNandhu opened this issue · 3 comments
PoovendhanNandhu commented
kirizarry47 commented
how did you resolve the useEffect error?
PoovendhanNandhu commented
how did you resolve the useEffect error?
so we shouldn't use useEffect inside the home function (in this case). We shouldn't include any superstates insde the main function.
Ankitv003 commented
how did you resolve the useEffect error?
it can also be resolved using a cleanup function, like this
useEffect(() => {
const timeoutId = setTimeout(() => {
setLetterClass('text-animate-hover');
}, 4000);
// Cleanup function to clear the timeout if the component unmounts or the effect is re-triggered
return () => {
clearTimeout(timeoutId);
};
}, []);