
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-hotkey-hook
Advanced tools
A react hook which can execute any function for any keyboard shortcut.
A react hook which can execute any function for any keyboard shortcut.
Install the package with npm or yarn with either of the following commands.
npm i react-hotkey-hook
yarn add react-hotkey-hook
Make sure to import the useHotkey hook from the library after it is installed
import useHotkey from "react-hotkey-hook";
import "./App.css";
import React from "react";
import useHotkey from "react-hotkey-hook";
function App() {
const onKeyPress = () => {
console.log("key pressed");
};
useHotkey("Control+a", true, onKeyPress);
useHotkey("Shift+A", true, onKeyPress);
return (
<div className="container">
<h1>Example for React Hotkey Hook</h1>
</div>
);
}
export default App;
All options are optional and have a default value which you can override to change the behavior of the hook.
| Option | Type | Description |
|---|---|---|
hotkeys | string | The combination of hotkeys. |
overide | boolean | Optional Parameter. Prevents default event when true. True on default. |
callback | () => void | Function that will be called when the combination of keys are pressed. |
Distributed under the MIT License. See LICENSE for more information.
FAQs
A react hook which can execute any function for any keyboard shortcut.
The npm package react-hotkey-hook receives a total of 263 weekly downloads. As such, react-hotkey-hook popularity was classified as not popular.
We found that react-hotkey-hook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.