Skip to content
All components

use-mobile

Hook

Whether the viewport is below the mobile breakpoint, resolved after mount so the server never guesses.

import { useIsMobile } from "@/hooks/use-mobile"

export function Nav() {
  const isMobile = useIsMobile()

  return isMobile ? <MobileNav /> : <DesktopNav />
}
Install
The CLI writes the file into your project, with every item it depends on.
npx @tdpxl/cli add use-mobile
Dependencies
Derived from this file's real imports when the registry was built.

npm

None.

registry

None.