3
In this reply from Soen, one uses a useEffect
with two Arrow functions followed. Thus:
useEffect(() => () => { window.removeEventListener('resize', compareSize); }, []);
I wonder why the duo Arrow Function is being used up there. What is the difference between a useEffect
with only one Arrow Function for a useEffect
with two Arrow functions (as the above example)?
For example, this:
useEffect(() => { compareSize(); window.addEventListener('resize', compareSize); }, []);