1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

fixed window callers

This commit is contained in:
Fedor Katurov 2022-01-07 19:16:42 +07:00
parent ba2e610e01
commit 224c27b6f4
6 changed files with 55 additions and 26 deletions

View file

@ -0,0 +1,10 @@
import { useMemo } from 'react';
export const useWindowSize = () =>
useMemo(() => {
if (typeof window === 'undefined') {
return { innerWidth: 0, innerHeight: 0 };
}
return { innerWidth: window.innerWidth, innerHeight: window.innerHeight };
}, []);