Answers for "how to use cookies in react js"

2

how to use cookies in react js

const [cookies, setCookie, removeCookie] = useCookies(['cookie-name']);
Posted by: Guest on March-23-2021
0

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);
Posted by: Guest on September-16-2021
2

how to use cookies in react js

const [cookies, setCookie, removeCookie] = useCookies(['cookie-name']);
Posted by: Guest on March-23-2021
0

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);
Posted by: Guest on September-16-2021

Code answers related to "how to use cookies in react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language