chore: run prettier
This commit is contained in:
parent
9cdbbc3a00
commit
155d7bb876
76 changed files with 788 additions and 550 deletions
|
@ -3,10 +3,10 @@ import { debounce } from 'debounce';
|
|||
|
||||
type DebounceFn<V> = ((value: V) => void) & { clear: () => void };
|
||||
|
||||
export default <S> (initial: S, interval?: number, immediate?: boolean): [ S, DebounceFn<S> ] => {
|
||||
const [ state, setState ] = useState<S>(initial);
|
||||
export default <S>(initial: S, interval?: number, immediate?: boolean): [S, DebounceFn<S>] => {
|
||||
const [state, setState] = useState<S>(initial);
|
||||
|
||||
const debouncedSetState = debounce((v: S) => setState(v), interval, immediate);
|
||||
|
||||
return [ state, debouncedSetState ];
|
||||
return [state, debouncedSetState];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue