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