mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed window callers
This commit is contained in:
parent
ba2e610e01
commit
224c27b6f4
6 changed files with 55 additions and 26 deletions
10
src/hooks/dom/useWindowSize.ts
Normal file
10
src/hooks/dom/useWindowSize.ts
Normal 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 };
|
||||
}, []);
|
Loading…
Add table
Add a link
Reference in a new issue