1.0.0 • Published 3 years ago

use-debounce-effect v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

use-debounce-effect

useEffect hook that debounces the effect

NPM JavaScript Style Guide

Install

npm install --save use-debounce-effect

Usage

import React, { useState } from 'react'
import axios from 'axios';
import { useDebounceEffect } from '@bellawatt/react-hooks'

const DebounceEffectExample = () => {
  const [value, setValue] = useState('');

  useDebounceEffect(() => {
    someSlowFunction();
  }, 1000, [value]));

  return (
    <div>
      <input value={value} onChange={e => setValue(e.currentTarget.value)} />
    </div>
  )
}

License

MIT © bellawatt


This hook is created using create-react-hook.