@brightleaf/react-hooks
Advanced tools
Comparing version 0.12.1 to 0.13.0
@@ -54,2 +54,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useKeypress", { | ||
enumerable: true, | ||
get: function () { | ||
return _useKeypress.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useLocalStorage", { | ||
@@ -114,2 +120,4 @@ enumerable: true, | ||
var _useKeypress = _interopRequireDefault(require("./use-keypress")); | ||
var _useLocalStorage = _interopRequireDefault(require("./use-local-storage")); | ||
@@ -116,0 +124,0 @@ |
{ | ||
"name": "@brightleaf/react-hooks", | ||
"version": "0.12.1", | ||
"version": "0.13.0", | ||
"description": "Useful react hooks", | ||
@@ -34,3 +34,4 @@ "files": [ | ||
"@hapi/nes": "^11.2.0", | ||
"graphql-request": "^1.8.2" | ||
"graphql-request": "^1.8.2", | ||
"highlight.js": "^9.15.8" | ||
}, | ||
@@ -37,0 +38,0 @@ "devDependencies": { |
@@ -11,2 +11,3 @@ # Brightleaf React Hooks | ||
* `useGraphQL` - Hook to make a GraphQL request | ||
* `useKeypress` - Hook to Keypress | ||
* `useNes` - Hook to connect to Hapijs NES | ||
@@ -68,3 +69,24 @@ * `useWebSockets` - Hook to interact with WebSockets | ||
``` | ||
## Keypress Hook | ||
```jsx | ||
import React from 'react' | ||
import { useKeypress } from '@brightleaf/react-hooks' | ||
export default () => { | ||
const aKeyDown = useKeypress('a') | ||
return ( | ||
<div className="App content"> | ||
<h2>Key Press?</h2> | ||
{aKeyDown && ( | ||
<div> | ||
Yes, the <b>{'"a"'}</b> key is pressed | ||
</div> | ||
)} | ||
{!keyDown && <div>No the <b>{'"a"'}</b> key is not currently pressed</div>} | ||
</div> | ||
) | ||
} | ||
``` | ||
## Post Hook | ||
@@ -71,0 +93,0 @@ |
39456
24
1104
324
4
+ Addedhighlight.js@^9.15.8
+ Addedhighlight.js@9.18.5(transitive)