mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
20 lines
425 B
TypeScript
20 lines
425 B
TypeScript
import { useEffect, useState } from 'react';
|
|
|
|
function hasWideFormat() {
|
|
return typeof window !== 'undefined' && window.innerWidth > 880;
|
|
}
|
|
|
|
export function useWideFormat() {
|
|
const [wideFormat, setWideFormat] = useState(hasWideFormat());
|
|
|
|
useEffect(() => {
|
|
function handleResize() {
|
|
setWideFormat(hasWideFormat());
|
|
}
|
|
|
|
window.addEventListener('resize', handleResize);
|
|
}, []);
|
|
|
|
return wideFormat;
|
|
}
|