npm.io
1.0.0 • Published 3 years ago

simple-react-cookie

Licence
MIT
Version
1.0.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0

A simple and lightweight package for handling cookies in React.js applications.

Installation

You can install the package via npm:

npm install simple-react-cookie

Usage

Here's how you can use the react-cookie package in your React.js application:

Importing the Package

import React from 'react';
import { setCookie, getCookie, removeCookie } from 'simple-react-cookie';
// Syntax: setCookie(name, value, options)
setCookie('username', 'JohnDoe', { expires: 30, path: '/' });
//expires is in day format
// Syntax: getCookie(name)
const username = getCookie('username');
console.log(`Username: ${username}`);
// Syntax: removeCookie(name)
removeCookie('username');

License

This package is open-source and available under the MIT License. Feel free to use, modify, and distribute it according to the terms of the license.

Issues and Contributions

If you encounter any issues or have suggestions for improvement, please create an issue on the GitHub repository.

Contributions are welcome! If you'd like to contribute to the development of this package, please fork the repository and submit a pull request.

Author

Oktay Kopcak

Keywords