usehooks README

The project's README from github.com/uidotdev/usehooks. As one markdown file: README.md.

useHooks

useHooks

A collection of modern, server-safe React hooks – from the ui.dev team.

Compatible with React v18.0.0+.

Standard

Install

npm i @uidotdev/usehooks

Hooks

Experimental

Install

npm i @uidotdev/usehooks@experimental react@experimental react-dom@experimental

Hooks

usehooks (uidotdev/usehooks)

Searching Database…

11.5K ·GitHub
What is this?useHooks is a collection of modern, server-safe React hooks maintained by the ui.dev team, covering common needs like debouncing, local storage, media queries, and geolocation.
Is this a framework or just a set of utility functions?It's a lightweight utility library of standalone React hooks, not a framework — you import only the hooks you need.
How do I add it to my project?Install the standard package with npm, then import whichever hooks you need directly from it.
What React version do I need?It requires React v18.0.0 or later; the experimental build additionally needs the experimental React and React DOM releases.
What's the catch with the experimental hooks?Experimental hooks like useFetch, useInterval, and useEventListener require installing the @uidotdev/usehooks@experimental tag along with React's experimental channel, which is less stable than the standard release.
What does 'server-safe' mean for these hooks?It means the hooks are written to avoid errors during server-side rendering, so they work safely in frameworks like Next.js where components can render on the server before hydration.
How many hooks does the standard package include?Around 37 standard hooks are listed, covering things like useBattery, useDebounce, useLocalStorage, useMediaQuery, useIntersectionObserver, and useWindowSize.
What kinds of problems do the experimental hooks solve?They add extras like data fetching (useFetch), timers (useInterval, useTimeout, useCountdown), and event handling (useEventListener, useKeyPress) that aren't in the stable set yet.
Creator
uidotdev
Size
3.1 MB
Stars
11.5K
Age
7y
Commits · 90 Days