Commit e786d704 authored by Robert Knight's avatar Robert Knight

Add a note about `useShortcut` vs `onKeyDown`

parent 2b19174d
...@@ -87,8 +87,12 @@ export function installShortcut( ...@@ -87,8 +87,12 @@ export function installShortcut(
* An effect hook that installs a shortcut using `installShortcut` and removes * An effect hook that installs a shortcut using `installShortcut` and removes
* it when the component is unmounted. * it when the component is unmounted.
* *
* This provides a convenient way to enable a shortcut while a component is * This provides a convenient way to enable a document-level shortcut while
* rendered. To conditionally disable the shortcut, set `shortcut` to `null`. * a component is mounted. This differs from adding an `onKeyDown` handler to
* one of the component's DOM elements in that it doesn't require the component
* to have focus.
*
* To conditionally disable the shortcut, set `shortcut` to `null`.
* *
* @param {string|null} shortcut - * @param {string|null} shortcut -
* A shortcut key sequence to match or `null` to disable. See `matchShortcut`. * A shortcut key sequence to match or `null` to disable. See `matchShortcut`.
......
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