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

react-powerhooks

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-powerhooks

Hooks api for common powerplugs

  • 0.0.3
  • npm
  • Socket score

Version published
Weekly downloads
36
increased by12.5%
Maintainers
1
Weekly downloads
 
Created
Source
React PowerHooks react-powerhooks

⚠️ Warning: hooks are not part of a stable React release yet, so use this library only for experiments

Demo

Install

yarn add react-powerhooks

About

react-powerhooks is a set of react custom-hooks equivalent to the render props components in react-powerplug Heavily inspired by react-hangers The logo is from wikimedia commons

API

useToggle

This is a hook that lets you toggle between boolean values. It needs an initialValue to work with.

Usage

const initialValue = true;
const [currentValue, toggleAway] = useToggle(initialValue);
useActive

This hook lets you know when your mouse pointer is active on a particular element. It needs a ref of the element in question to work with. It can also take an onChange callback which it calls everytime the active state changes. The onChange function recieves the current active state of the element as a boolean value.

Usage

const ref = useRef(null); // Use the ref in the element concerned.
// More about useRef here https://reactjs.org/docs/hooks-reference.html#useref
const activeValue = useActive({ refEl: ref });
useInterval

This hook starts an interval timer that can be stopped/resumed any time. It takes in startImmediate which decides whether the interval is on by default. It also takes a time which is the interval duration.

It provides a start and stop method which allow us to control the state of the interval.

Usage

const { start, stop } = useInterval({ time, startImmediate });

FAQs

Package last updated on 28 Oct 2018

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