1 year ago

#183901

test-img

sofshant

React-cookie not updating when changed from console

I'm working with the react-cookie library and am running into an issue. Basically, when a cookie is changed from the console, the app doesn't refresh the cookie and keeps the old saved one. For example, if the value of the original cookie was 123 and from console I changed it to 456, the app will keep reading the cookie as 123 until reloaded. Is there any workaround to this? Thanks in advance!

Code example:

const [cookies, setCookie, removeCookie] = useCookies(['jwt']);

// Issue: cookies.jwt value stays the same even if it's changed.
if (cookies.jwt) {
        // do stuff
}

reactjs

react-cookie

0 Answers

Your Answer

Accepted video resources