Im creating a system were it simply needs to read a cookie
A cookie can be either named “Default” or “Login”
when the Cookie is name "Default " it works fine but when it is called “Login”
it does not work, i find it very strange.
code:
const[cookie,setCookie,removeCookie] = useCookies(['Login']);
useEffect(() =>{
(async() =>{
let tokenacces;
if(cookie.Login !== null){
console.log("cookie in if statement", cookie.Login)
tokenacces = cookie.Login;
}
else if(cookie.Default !== null){
tokenacces = cookie.Default}
console.log("read cookie", tokenacces)
// some other codes......
})()
},[render])
it reads the cookie here:
if(cookie.Login !== null){
console.log("cookie in if statement", cookie.Login)
but it does not show the cookie value here:
console.log("read cookie", tokenacces)
and when cookie is name “Default” it always reads it perfectly
that makes no sense to me at all.