fix: guard useIsMobile in non-browser
This commit is contained in:
@@ -6,6 +6,7 @@ export function useIsMobile(breakpoint = 768) {
|
|||||||
));
|
));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
const update = () => setIsMobile(window.innerWidth < breakpoint);
|
const update = () => setIsMobile(window.innerWidth < breakpoint);
|
||||||
update();
|
update();
|
||||||
window.addEventListener('resize', update);
|
window.addEventListener('resize', update);
|
||||||
|
|||||||
Reference in New Issue
Block a user