diff --git a/demo/src/index.js b/demo/src/index.js index 70abb586..09777cf0 100644 --- a/demo/src/index.js +++ b/demo/src/index.js @@ -10,6 +10,7 @@ class Demo extends Component { output: `Hello, I am a component that listens to keydown and keyup of a.
你好,我是一个监听keydown和keyup的组件。
请摁下【shift+a】或者【alt+s】是一下效果`, + mount: true, } } onKeyUp(keyName, e, handle) { @@ -25,26 +26,36 @@ class Demo extends Component { }); } render() { + const { mount } = this.state; return ( - -
-

react-hotkeys

-
-   +
+ {mount && ( + +
+

react-hotkeys

+
+     -
-

- React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts. - Uses a fork of hotkeys.js for keydown detection of special characters. You give it a keymap of shortcuts & it bind it to the mousetrap singleton. The, it'll unbind it when the component unmounts. -

-
-
- +
+

+ React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts. + Uses a fork of hotkeys.js for keydown detection of special characters. You give it a keymap of shortcuts & it bind it to the mousetrap singleton. The, it'll unbind it when the component unmounts. +

+
+
+
+ )} + +
) } }