mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
23 lines
509 B
TypeScript
23 lines
509 B
TypeScript
import { useEffect, useState } from 'react';
|
|
|
|
/**
|
|
* @deprecated DO NOT USE; CAUSES NEXT JS HYDRATION ISSUES
|
|
*/
|
|
export function useWideFormat(size = 880) {
|
|
function hasWideFormat() {
|
|
return typeof window !== 'undefined' && window.innerWidth > size;
|
|
}
|
|
|
|
const [wideFormat, setWideFormat] = useState(hasWideFormat());
|
|
|
|
useEffect(() => {
|
|
function handleResize() {
|
|
setWideFormat(hasWideFormat());
|
|
}
|
|
|
|
window.addEventListener('resize', handleResize);
|
|
}, []);
|
|
|
|
return wideFormat;
|
|
}
|