diff --git a/src/useSize.tsx b/src/useSize.tsx index c0f8776fa0..214ceaf16c 100644 --- a/src/useSize.tsx +++ b/src/useSize.tsx @@ -67,7 +67,7 @@ const useSize = ( } return () => { - if (window) { + if (window && window.removeEventListener) { window.removeEventListener('resize', setSize); } };