mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: remove useWideFormat
This commit is contained in:
1 parent
332c1787f4
commit
697497b11e
4 files changed
+39
-62
No files matched your search
@@ -1,22 +0,0 @@
|
||||
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;
|
||||
}
|
||||
Reference in new issue
Block a user