MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / useIsMobile

Function useIsMobile

web/src/hooks/useIsMobile.js:5–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { useSyncExternalStore } from 'react';
4
5export const useIsMobile = () => {
6 const query = `(max-width: ${MOBILE_BREAKPOINT - 1}px)`;
7 return useSyncExternalStore(
8 (callback) => {
9 const mql = window.matchMedia(query);
10 mql.addEventListener('change', callback);
11 return () => mql.removeEventListener('change', callback);
12 },
13 () => window.matchMedia(query).matches,
14 () => false,
15 );
16};

Callers 13

HeaderBarFunction · 0.90
PageLayout.jsFile · 0.90
ChannelsTable.jsFile · 0.90
EditChannel.jsFile · 0.90
EditRedemption.jsFile · 0.90
EditToken.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
AddUser.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected