Skip to content

Usage in the readme is wrong #5

@jing2si

Description

@jing2si
import * as React from 'react';
import { useComboKeys } from 'react-combo-keys';

function SearchBar(props: {}) {
    const input = Rwact.useRef();

    useComboKeys({
-        'Mod+F': () => {
+        'mod+f': () => {
            input.current.focus();
        },
-        'Mod+': () => {
+        'mod+s': () => {
            alert('Settings !')
        }
-    }, {}, []);
+    }, []);

    return <input type="text" ref={input} />;
}

BTW
First of all, thank you for this very usefully library.
Is it possible to add an option for disable or enable shortcut by some conditional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions