react-use-interval-hook

1.0.3 • Public • Published

react-use-interval-hook

A basic useInterval hook for React. Works just like you would expect setInterval to work.

NPM JavaScript Style Guide

Install

npm install --save react-use-interval-hook

Usage

import React, { useState } from "react";
import { useInterval } from "react-use-interval-hook";

const ExampleCounter = () => {
  const [count, setCount] = useState(0);

  useInterval(() => {
    setCount(count + 1);
  }, 1000);

  return <div>Count is: {count}</div>;
};

License

MIT © bnzone

/react-use-interval-hook/

    Package Sidebar

    Install

    npm i react-use-interval-hook

    Weekly Downloads

    28

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    1.34 MB

    Total Files

    20

    Last publish

    Collaborators

    • bnzone