Skip to content

An opinionated toast component for React.

fix: event listener removal in hooks.tsx (#711)

Vishwa Gauravc2d6990a3eee
diff --git a/src/hooks.tsx b/src/hooks.tsx
index ef0d524..ee79b01 100644
--- a/src/hooks.tsx
+++ b/src/hooks.tsx
@@ -8,7 +8,7 @@ export const useIsDocumentHidden = () => {
setIsDocumentHidden(document.hidden);
};
document.addEventListener('visibilitychange', callback);
- return () => window.removeEventListener('visibilitychange', callback);
+ return () => document.removeEventListener('visibilitychange', callback);
}, []);
return isDocumentHidden;