ui(admin): add "working" React admin ui
This commit is contained in:
parent
d1c7494933
commit
5402584508
199 changed files with 13387 additions and 151 deletions
12
resources/scripts/plugins/useDebouncedState.ts
Normal file
12
resources/scripts/plugins/useDebouncedState.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { useState } from 'react';
|
||||
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);
|
||||
|
||||
const debouncedSetState = debounce((v: S) => setState(v), interval, immediate);
|
||||
|
||||
return [ state, debouncedSetState ];
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue