1.0.7 • Published 3 years ago

@johnfanidis/usekeypress v1.0.7

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

@johnfanidis/usekeypress

npm (scoped) npm bundle size (minified)

React keypress hook.

Install

$ npm install @johnfanidis/usekeypress

Usage

import useKeyPress from "@johnfanidis/usekeypress";

const MyComponent = () => {
    
    // Sets up the hook listening for the 'S' key
    const pressed_V_Key = useKeyPress(83, true);

    useEffect(() => {
        if (pressed_S_Key) {
            // do something when 'S' key is pressed
        }
    }, [pressed_S_Key]);
    
  return null;
}
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago