mirror of
https://github.com/usememos/memos.git
synced 2025-01-05 04:58:02 +03:00
fix: failed eslint checks (#1616)
This commit is contained in:
parent
f12163bc94
commit
3314fe8b0e
@ -15,11 +15,9 @@ function useLatestValue<T>(value: T) {
|
||||
}
|
||||
|
||||
// TODO: Add React.useEvent ?? once the useEvent hook is available
|
||||
function useEvent<F extends (...args: any[]) => any, P extends any[] = Parameters<F>, R = ReturnType<F>>(
|
||||
cb: (...args: P) => R
|
||||
) {
|
||||
function useEvent<F extends (...args: any[]) => any, P extends any[] = Parameters<F>, R = ReturnType<F>>(cb: (...args: P) => R) {
|
||||
const cache = useLatestValue(cb);
|
||||
return React.useCallback((...args: P) => cache.current(...args), [cache]);
|
||||
};
|
||||
}
|
||||
|
||||
export default useEvent;
|
||||
|
Loading…
Reference in New Issue
Block a user