MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / useDevice

Function useDevice

apps/web/hooks/device.tsx:4–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import useResize from './resize';
3
4function useDevice() {
5 const [isMobile, setMobile] = useState(false);
6
7 useResize({
8 onResize() {
9 if (window.innerWidth < 1024) {
10 setMobile(true);
11 } else {
12 setMobile(false);
13 }
14 },
15 });
16
17 return { isMobile };
18}
19
20export default useDevice;

Callers 1

SidebarLayoutFunction · 0.85

Calls 1

useResizeFunction · 0.85

Tested by

no test coverage detected