A custom React Hook for debouncing user inputs on Input and Textarea elements.
Installation
npm install --save useinputdebounce
Example
;;; { const results setSearch = ; const effect = async { const res = await ; ; }; const attributes = ; return <div> <input ...attributes placeholder="Search Country..." /> results </div> ;} const rootElement = document;ReactDOM; { return ;}
CodeSandbox Example
- Fetching Data: Sandbox
API Reference
const value onChange =
sideEffect
: a function that will be excuted after a delay. You can perform actions like fetching data.opts
: an object whose values can be { delay, minLength, initial }
License
This software is free to use under the MIT license. See the LICENSE file for license text and copyright information.