Socket
Socket
Sign inDemoInstall

react-keybindings

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-keybindings - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "react-keybindings",
"version": "1.0.2",
"version": "1.0.3",
"description": "Add keybindings in React apps",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -13,10 +13,16 @@ # React Keybindings

## Usage
## Usage of `mapActionsToKeys(keymap)`
React Keybindings provides a `mapActionsToKeys` higher-order component to wrap an existing component. It allows you to map actions to shortcuts and get the triggered actions in props.
React Keybindings provides a higher-order component to wrap an existing component. It allows you to map actions to shortcuts. Then you are able to know which actions have been triggered and which keys have been pressed.
You can write shortcuts as strings (e.g. `"ctrl+shift+s"`) or as arrays of key codes (e.g. `[17, 65]`).
### Arguments
Example:
* `keymap` (_Object_): this is an object which map actions to shortcuts. You can write shortcuts as strings (e.g. `"ctrl+shift+s"`) or as arrays of key codes (e.g. `[17, 65]`).
### Returns
It returns a React component class that injects `pressedKeys` and `keyActions` into your component.
## Example
```js

@@ -23,0 +29,0 @@ import React from "react"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc