Is there way to return 2 items in the same return of the arrow function?
useEffect(() => {
return () =>
removeEventListener('scroll', handleScroll) and setName('');
}, []);
Please don’t offer using useEffect twice
>Solution :
just change your code to this:
useEffect(() => {
return () => {
removeEventListener('scroll', handleScroll);
setName('');
}
}, []);
But setting state on unMount is not suggested