FireFox not able to react Cookie, only after Reloading page

I need to read a cookie, in Google Chrome i dont have this issue but with Firefox it seems that its unable to read a cookie

When i check in Firefox “Cookies” folder i see the cookie. but its not able to read
it sends “undefined”


const[cookies,setCookies,removeCookie] = useCookies(['Login'])

useEffect(() =>{
            (async() =>{
                console.log("cookie", cookies.Default)

output: cookie undefined

if i reload the page it gives the right cookie name

Can anyone help me with this

What happens if you log cookies rather than cookies.Default?

it returns a empty object

I’m wondering…having the empty dependency brackets tells react to run this useEffect on page load only.

If this is the first time visiting this url, the cookies shouldn’t be set at page load.

Which useCookies implementation are you using? Or did you make your own hook?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.