Unverified Commit 3314fe8b authored by João Nuno Mota's avatar João Nuno Mota Committed by GitHub

fix: failed eslint checks (#1616)

parent f12163bc
......@@ -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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment