how to use cookies in react js
const [cookies, setCookie, removeCookie] = useCookies(['cookie-name']);
how to use cookies in react js
const [cookies, setCookie, removeCookie] = useCookies(['cookie-name']);
create cookie javascript react
createCookieInHour: (cookieName, cookieValue, hourToExpire) => {
let date = new Date();
date.setTime(date.getTime()+(hourToExpire*60*60*1000));
document.cookie = cookieName + " = " + cookieValue + "; expires = " +date.toGMTString();
},
//create any new cookie
createCookieInHour('cookieName', 'cookieValue', 5);
//view cookies
let cookie = document.cookie.split(';');
console.log('cookie : ', cookie);
how to use cookies in react js
const [cookies, setCookie, removeCookie] = useCookies(['cookie-name']);
create cookie javascript react
createCookieInHour: (cookieName, cookieValue, hourToExpire) => {
let date = new Date();
date.setTime(date.getTime()+(hourToExpire*60*60*1000));
document.cookie = cookieName + " = " + cookieValue + "; expires = " +date.toGMTString();
},
//create any new cookie
createCookieInHour('cookieName', 'cookieValue', 5);
//view cookies
let cookie = document.cookie.split(';');
console.log('cookie : ', cookie);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us