Team Disco
- Dylan Roberts
- James Viall
Typing the useState React hook
| ## First let's download YADM using Homebrew | |
| brew install yadm | |
| ## did it work? You can check out the docs at https://yadm.io | |
| which yadm | |
| ## YADM, as well as many other dotfile managament tools, uses the same commands as Git such as checkout, add, and commit | |
| ## We can use `yadm clone` to get a dotfiles repo going. So let's create a new repo called "dotfiles" and then clone it | |
| open https://github.com/new?name=dotfiles | |
| yadm clone jviall/dotfiles |
| export function useAsyncDebounce<T extends (args: any[]) => any>(defaultFn: T, defaultWait: number): T { | |
| const debounceRef = React.useRef<{ | |
| promise?: Promise<T>, | |
| resolve?: (value: T | PromiseLike<T>) => void, | |
| reject?: (reason?: any) => void, | |
| timeout?: NodeJS.Timeout | |
| }>({}) | |
| // the given args could be props, which change, so we want to always use latest definitions. | |
| const getDefaultFn = useGetLatest(defaultFn) |