🍪 A simple and lightweight package for handling cookies in React.js applications.
You can install the package via npm:
npm install simple-react-cookie
Here's how you can use the react-cookie package in your React.js application:
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');
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.
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.
Oktay Kopcak