spb/countryatlas
Public
TypeScript 57%
Python 38.6%
JavaScript 3.6%
CSS 0.6%
1'use client';2import { useEffect, useState } from 'react';34/** True at ≥ 768 px (Tailwind `md`). False during SSR and the first client render (mobile-first). */5export function useIsDesktop(): boolean {6 const [desktop, setDesktop] = useState(false);7 useEffect(() => {8 const mq = window.matchMedia('(min-width: 768px)');9 const apply = () => setDesktop(mq.matches);10 apply();11 mq.addEventListener('change', apply);12 return () => mq.removeEventListener('change', apply);13 }, []);14 return desktop;15}16