@brightleaf/react-hooks
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -30,2 +30,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useLocalStorage", { | ||
enumerable: true, | ||
get: function () { | ||
return _useLocalStorage.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useNes", { | ||
@@ -43,2 +49,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "usePut", { | ||
enumerable: true, | ||
get: function () { | ||
return _usePut.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useWebSockets", { | ||
@@ -59,2 +71,4 @@ enumerable: true, | ||
var _useLocalStorage = _interopRequireDefault(require("./use-local-storage")); | ||
var _useNes = _interopRequireDefault(require("./use-nes")); | ||
@@ -64,4 +78,6 @@ | ||
var _usePut = _interopRequireDefault(require("./use-put")); | ||
var _useWebsockets = _interopRequireDefault(require("./use-websockets")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -20,3 +20,2 @@ "use strict"; | ||
const postData = async data => { | ||
console.info('post data'); | ||
dispatch({ | ||
@@ -23,0 +22,0 @@ type: 'get' |
{ | ||
"name": "@brightleaf/react-hooks", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "Useful react hooks", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -12,2 +12,3 @@ # Brightleaf React Hooks | ||
* `useWebSockets` - Hook to interact with WebSockets | ||
* `useLocalStorage` - Hook to local storage | ||
@@ -228,1 +229,20 @@ ## GraphQL Hook | ||
## Local Storage Hook | ||
```javascript | ||
import React, { useRef } from 'react' | ||
import { useLocalStorage } from '@brightleaf/react-hooks' | ||
export default () => { | ||
const [count, setCount] = useLocalStorage(0); | ||
return ( | ||
<div> | ||
<p>You clicked {count} times</p> | ||
<button onClick={() => setCount(count + 1)}> | ||
Click me | ||
</button> | ||
</div> | ||
); | ||
} | ||
``` |
21451
14
590
246
4