react-use README

The project's README from github.com/streamich/react-use. As one markdown file: README.md.



👍
react-use





npm package CircleCI master npm downloads demos
Collection of essential React Hooks. Port of libreact.
Translations: 🇨🇳 汉语




npm i react-use












Usage — how to import.
Unlicense — public domain.
Support — add yourself to backer list below.






Contributors








react-use (streamich/react-use)

Searching Database…

What is this?react-use is a large collection of reusable React Hooks covering sensors, UI interactions, animations, side-effects, lifecycles, and state management.
Is it a framework or a library?It's a library of standalone hooks you import individually into your existing React app, not a framework.
How do I add it to a project?Install it with npm or yarn, then import the specific hooks you need, e.g. `import {useToggle} from 'react-use'`.
Do I need anything beyond React itself?It's built on top of React Hooks, so you need a React version that supports hooks; some individual hooks pull in small helper packages like js-cookie or screenfull internally.
Do all these hooks work the same in server-side rendering?Not necessarily — the library ships useIsomorphicLayoutEffect specifically because useLayoutEffect behaves differently on the server, and there's a dedicated SSR test config.
How many hooks does this provide roughly?Dozens, grouped into categories like Sensors, UI, Animations, Side-effects, Lifecycles, State, and Miscellaneous — covering things like battery status, geolocation, mouse position, clipboard, cookies, local/session storage, and more.
Can I share state between components with these hooks?Yes, createGlobalState, createReducerContext, and createStateContext are included specifically for sharing state across components.
Is there a live demo for each hook?Most hooks include an inline demo GIF/image in the README showing the hook in action.
Are there translations of the documentation?Yes, the README mentions ports/translations are available in addition to the English version.
Creator
streamich
Size
82.8 MB
Stars
44K
Age
7y
Commits · 90 Days