-
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Describe the bug
Console error when component gets unmounted.
To Reproduce
Steps to reproduce the behavior:
- use
useKey()/useKeyCombo() - unmount the component
- See error
Expected behavior
No errors.
Additional context
Using a custom component:
import {
bindKey,
bindKeyCombo,
unbindKey,
unbindKeyCombo,
} from "@rwh/keystrokes";
import { useEffect } from "react";
export function useKey(...args: Parameters<typeof bindKey>) {
useEffect(() => {
bindKey(...args);
return () => unbindKey(...args);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, args);
}
export function useKeyCombo(...args: Parameters<typeof bindKeyCombo>) {
useEffect(() => {
bindKeyCombo(...args);
return () => unbindKeyCombo(...args);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, args);
}Metadata
Metadata
Assignees
Labels
No labels