🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-useinterval

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-useinterval

A React hook that wraps setInterval

0.1.0
Source
npm
Version published
Weekly downloads
5.4K
-1.71%
Maintainers
1
Weekly downloads
 
Created
Source

Install

Install with npm:

$ npm install --save react-useinterval

Example Usage

import React, { useState, useEffect, useRef } from 'react';
import useInterval from 'react-useinterval';

function Counter() {
  let [count, setCount] = useState(0);

  useInterval(() => {
    setCount(count + 1);
  }, 1000);
  return <h1>{count}</h1>;
}

Thanks

Inspired by Dan Abramov's blog post here.

Keywords

react

FAQs

Package last updated on 04 Feb 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