Dev Resources
useHooks favicon

useHooks

Code Snippet/Programming

Easy to understand React Hook recipes.

useHooks's website screenshot

About useHooks

useHooks is a collection of reusable React hooks maintained by the ui.dev team, installed via the npm package @uidotdev/usehooks. The hooks are described as modern and server-safe, and the library covers a wide range of common frontend needs including browser storage (useLocalStorage, useSessionStorage), DOM and viewport tracking (useIntersectionObserver, useMeasure, useWindowSize, useWindowScroll), user interaction (useHover, useClickAway, useLongPress, useKeyPress, useMouse), timing and scheduling (useDebounce, useThrottle, useInterval, useTimeout, useCountdown), state management utilities (useToggle, useMap, useSet, useQueue, useList, useObjectState, useDefault, useHistoryState), device and network status (useBattery, useGeolocation, useOrientation, useNetworkState, usePreferredLanguage), and debugging aids (useRenderCount, useRenderInfo, useLogger).

The site is aimed at React developers looking for ready-made hooks to handle common UI and browser-API patterns without writing them from scratch. It is presented alongside other ui.dev resources, including a course on building the hooks from scratch, a public code repository, and JavaScript/React newsletters.

Key features

  • Collection of 50+ modern, server-safe React hooks
  • Installable as a single npm package (@uidotdev/usehooks)
  • Covers browser APIs like localStorage, sessionStorage, geolocation, and battery status
  • Hooks for UI interaction patterns like click-away, long-press, hover, and key press detection
  • Performance and debugging hooks such as useRenderCount, useRenderInfo, and useLogger
  • Open source with source code available in a public repo

Frequently asked questions

How do I install useHooks?

Install it via npm with `npm i @uidotdev/usehooks`.

What framework does useHooks target?

It is a collection of React hooks, built by the ui.dev team, designed to be server-safe.

Is the source code available?

Yes, the repo is publicly viewable and linked from the site.

Who maintains useHooks?

It is maintained by the ui.dev team.

Advertise here

Featured products

  • SerpApi - Search API favicon
  • CoreClaw favicon

Show your product to thousands of developers

· 100k monthly pageviews
· 7k newsletter subscribers

Advertise your product

You might also like