d36e8ec85f
* remove test_web * integrate reactjs-vite * update lint-staged * simple cors proxy server which handles cookies and redirections * overrider global fetch with proxy call * simple examples for set cookies and fetch request * app bar * add redux * loadPlugins. error: cant load urlencode module * add ts-node for transforming * plugin search & select * plugin slice * accordion components * path item & popular novel * optional for filters * search novel * parse novel * parseChapter * update cookies * default filters * fix: import path * bundler module resolution * new json_plugins * fix: generate multisrc (missing filters) * fix: host scripts * fix: plugin code path * remove typechecking action
16 lines
346 B
TypeScript
16 lines
346 B
TypeScript
import { useEffect, useState } from 'react';
|
|
|
|
export default function useDebounce(text: string, delay: number) {
|
|
const [value, setValue] = useState('');
|
|
|
|
useEffect(() => {
|
|
const timerId = setTimeout(() => {
|
|
setValue(text);
|
|
}, delay);
|
|
return () => {
|
|
clearTimeout(timerId);
|
|
};
|
|
}, [text, delay]);
|
|
return value;
|
|
}
|