optimize useWindowSize

This commit is contained in:
Asad Umar 2022-02-05 00:49:55 +05:00 committed by Thomas Zarebczan
parent df320a2375
commit bdc5c2e9fb

View file

@ -21,8 +21,6 @@ export function useWindowSize(fn) {
if (isWindowClient) { if (isWindowClient) {
window.addEventListener('resize', setSize); window.addEventListener('resize', setSize);
setSize();
return () => window.removeEventListener('resize', setSize); return () => window.removeEventListener('resize', setSize);
} }
}, [fn, isWindowClient, setWindowSize, windowSize]); }, [fn, isWindowClient, setWindowSize, windowSize]);