Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rrudol/useCookie

🍪 React Hook for Cookies based on js-cookie 🍪
https://github.com/rrudol/useCookie

cookie react react-hooks

Last synced: about 2 months ago
JSON representation

🍪 React Hook for Cookies based on js-cookie 🍪

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)