MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / useIsMobile

Function useIsMobile

web/src/hooks/use-mobile.tsx:5–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3const MOBILE_BREAKPOINT = 768
4
5export function useIsMobile() {
6 const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
7
8 React.useEffect(() => {
9 const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
10 const onChange = () => {
11 setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
12 }
13 mql.addEventListener('change', onChange)
14 setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
15 return () => mql.removeEventListener('change', onChange)
16 }, [])
17
18 return !!isMobile
19}

Callers 12

SectionFunction · 0.90
sidebar.tsxFile · 0.90
CompetitionTabsFunction · 0.90
CompetitionSectionFunction · 0.90
FeatureSectionFunction · 0.90
RepositoryManagementFunction · 0.90
BillingStatusFunction · 0.90
TeamManagementFunction · 0.90
CreditMonitorFunction · 0.90
HeadingWithCopyLinkFunction · 0.90
OrganizationPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected