use-interval-hook
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Use Interval hook

Introduction

This hook is allow trigger callback on interval in React with ease (which often cause a lot of pain relating to closures), also it return function that allow more control over how often the callback is called

Example

import useInterval from "use-interval-hook";

callback = ()=>{
  console.log("Hello world!");
}

const {
    pause,
    activate,
    stop,
    timeLapse,
  } = useInterval({
  interval: 1000;
  callback,
  delay: 2000;
  })

/use-interval-hook/

    Package Sidebar

    Install

    npm i use-interval-hook

    Weekly Downloads

    290

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    15.2 kB

    Total Files

    9

    Last publish

    Collaborators

    • tuanbk1908