Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-hooks

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-hooks

https://usehooks.com as an npm package with TypeScript type definitions

  • 2.0.0-rc.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

use-hooks

npm version Greenkeeper badge

https://usehooks.com as an npm package with TypeScript type definitions.

Installation

npm install use-hooks
yarn add use-hooks

Available hooks

Hooks marked with "*" have minor differences (read below).

Differences

useAnimation

To supply a custom easing function just pass it as a first argument:

import { useAnimation } from 'use-hooks'

const inQuart = (t) => t * t * t * t
function MyComponent() {
	const animation = useAnimation(inQuart, 250)

	// ...
}

useDarkMode

The class name and element are hard coded on the website but in this package they're changable:

import { useDarkMode } from 'use-hooks'

const rootElement = document.getElementById('my-root-element')
function App() {
	useDarkMode('my-dark-mode-class-name', rootElement)

	// ...
}

useHistory

Added initialValue to the clear callbacks dependencies.

useKeyPress

A second useDependencies argument was added allowing the effect to re-run when arguments change.

useMedia

A fourth useDependencies argument was added allowing the effect to re-run when arguments change.

useOnScreen

A third useDependencies argument was added allowing the effect to re-run when arguments change.

useScript

Converted an Array.prototype.includes call to an Array.prototype.indexOf call to support ES5 environments.

useWindowSize

isClient boolean and getSize function moved out of hook body.

Credits

Thanks to @gabe_ragland for creating and maintaining https://usehooks.com

Thanks to @turbobabr for donating use-hooks package name

FAQs

Package last updated on 10 Oct 2019

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc