1.0.8 • Published 5 years ago

use-cooldown v1.0.8

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

use-cooldown

A React hook implementation for client-side rate limiting.

NPM JavaScript Style Guide Build Status

Install

npm install --save use-cooldown

Usage

import * as React from 'react';
import { useCooldown } from 'use-cooldown';

const Example = () => {
  const [cooledDown, setCooledDown] = useCooldown(1000); // pass in length of cooldown in ms
  const startCooldown = () => setCooledDown(false);
  return (
    <div>
      <div>{`${cooledDown}`}</div>
      <button disabled={!cooledDown} onClick={startCooldown}>
        Begin Cooldown
      </button>
    </div>
  );
};

License

MIT © vincentvella


This hook is created using create-react-hook.

1.0.8

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.0

5 years ago