Skip to content

alitoshmatov/use-delayed-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

useDelayedSearch

Usage of useDelayedSearch hook

Getting Started

You can use this react hook to get delayed value of string input, it helps to get final string after typing stops. You can adjust delayed time by passing time in milliseconds to useDelayedSearch hook.

Installation

To install and set up the library, run:

npm install -S use-delayed-search

Or if you prefer using Yarn:

yarn add --dev use-delayed-search

How to use

const Component = () => {
  const [value, delayedValue, setValue] = useDelayedSearch(1000);

  return (
    <>
      <input value={value} onChange={(e) => setValue(e.target.value)} />
      <p>Immediate value: {value}</p>
      <p>Delayed value: {delayedValue}</p>
    </>
  );
};

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published