Socket
Socket
Sign inDemoInstall

react-use

Package Overview
Dependencies
Maintainers
1
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use

Collection of React Hooks


Version published
Weekly downloads
1.5M
increased by3.83%
Maintainers
1
Weekly downloads
 
Created

Package description

What is react-use?

The react-use package is a collection of essential React hooks that provide a variety of functionalities to manage state, lifecycle, and side effects in functional components. It simplifies the process of creating complex components by abstracting common behavior into reusable hooks.

What are react-use's main functionalities?

State Management

Manage state with local storage persistence using useLocalStorage hook.

const [state, setState] = useLocalStorage('my-key', initialValue);

Lifecycle and Side Effects

Handle component lifecycle events with useEffectOnce hook.

useEffectOnce(() => { console.log('Component mounted'); return () => console.log('Component will unmount'); });

Sensors

Access sensor data like battery status using useBattery hook.

const state = useBattery();

Animations

Create animations with useSpring hook.

const [style, play] = useSpring({ from: { opacity: 0 }, to: { opacity: 1 } });

UI State

Control UI state such as fullscreen mode with useFullscreen hook.

const [isFullscreen, toggleFullscreen] = useFullscreen(ref);

Other packages similar to react-use

Changelog

Source

17.4.0 (2022-05-20)

Features

  • add usePinchZoom sensor hook (3e042cb)

Readme

Source



👍
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








FAQs

Package last updated on 20 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc