1.0.2 • Published 4 years ago

@ascendum/use-interval v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Blazing Fast license

react-use-interval

This is an customized version of the react hook for setting an interval as posted on overreacted.io.

Install

npm install --save @ascendum/use-interval

Usage

import as React from 'react'

import { useInterval } from 'react-use-interval'

const MyComponent = () => {
  const {
    toggleRunning,
    isRunning
  } = useInterval(() => {
    // Do whatever magic you wish here.
  }, 1000);

  return (
    <div>
      <button onClick={toggleRunning}>
        {isRunning ? 'Paused' : 'Resume'}
      </button>
    </div>
  );
}

License

MIT

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago