MCPcopy Create free account
hub / github.com/ShipSecAI/studio / useIsMobile

Function useIsMobile

frontend/src/hooks/useIsMobile.ts:3–18  ·  view source on GitHub ↗
(breakpoint = 768)

Source from the content-addressed store, hash-verified

1import { useState, useEffect } from 'react';
2
3export function useIsMobile(breakpoint = 768) {
4 const [isMobile, setIsMobile] = useState(
5 typeof window !== 'undefined' ? window.innerWidth < breakpoint : false,
6 );
7
8 useEffect(() => {
9 const handleResize = () => {
10 setIsMobile(window.innerWidth < breakpoint);
11 };
12
13 window.addEventListener('resize', handleResize);
14 return () => window.removeEventListener('resize', handleResize);
15 }, [breakpoint]);
16
17 return isMobile;
18}

Callers 3

WorkflowBuilderShellFunction · 0.90
WorkflowNodeFunction · 0.90
WorkflowBuilderContentFunction · 0.90

Calls 2

addEventListenerMethod · 0.45
removeEventListenerMethod · 0.45

Tested by

no test coverage detected