Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rrudol/useCookie
🍪 React Hook for Cookies based on js-cookie 🍪
https://github.com/rrudol/useCookie
cookie react react-hooks
Last synced: 3 months ago
JSON representation
🍪 React Hook for Cookies based on js-cookie 🍪
- Host: GitHub
- URL: https://github.com/rrudol/useCookie
- Owner: rrudol
- Created: 2018-12-13T23:36:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-29T21:53:04.000Z (over 1 year ago)
- Last Synced: 2024-07-18T12:15:45.304Z (4 months ago)
- Topics: cookie, react, react-hooks
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@use-hook/use-cookie
- Size: 6.84 KB
- Stars: 33
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# useCookie - React Hook
React Hook for Cookies based on [js-cookie](https://github.com/js-cookie/js-cookie)
## Instalation
```sh
npm install @use-hook/use-cookie --save
```## Usage
```javascript
import { useCookie } from "@use-hook/use-cookie";function App() {
const [name, setName] = useCookie("name", "Stefan");return (
setName(e.target.value, { expires: 1 })}
/>
);
}
```## Example
- [https://codesandbox.io/s/5v8x67nw8l](https://codesandbox.io/s/5v8x67nw8l)## License
[MIT](http://vjpr.mit-license.org)