You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I'm trying to import ReactJS project to NextJS, so I'm new to it. One issue I don't understand is I have cookie banner. It works as expected, and buttons react. But when I reload page again, it doesn't work anymore. Buttons dont react (even if I put console.log on button actions, even though on first load (like in incognito), it will work.
Additional information
Thisisfromlayout.jsreturn(<htmllang={locale}><bodyclassName={` antialiased`}><NextIntlClientProvidermessages={messages}><ShowCookielocale={locale}/>{children}</NextIntlClientProvider></body></html>``````"use client"const{ CookieMain }=require("./components/cookies/CookieMain");import{useEffect}from"react";import{useCookies}from"react-cookie";constShowCookie=({locale})=>{const[cookies,setCookie]=useCookies(["cookieNeccessary","cookieConsentOpen"]);console.log("show cookie loads ")return((cookies.cookieNeccessary!==true||cookies.cookieConsentOpen)===true&&<CookieMainlocale={locale}/>)}exportdefaultShowCookie;```And suprisingly, on every reload, <ShowCookie, shows 2 times, console.log("show cookie loads ") . But buttons inside, dont work. Like in <CookieMain ```useEffect(()=>{console.log("Component Rendered!");},[]);```
Showsonlyatfirst.OrwhenIdeletesitedata.I've disabled cache in network dev tab as well, still same issue.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
So, I'm trying to import ReactJS project to NextJS, so I'm new to it. One issue I don't understand is I have cookie banner. It works as expected, and buttons react. But when I reload page again, it doesn't work anymore. Buttons dont react (even if I put console.log on button actions, even though on first load (like in incognito), it will work.
Additional information
Example
https://nextjs-randolympics-frontend.vercel.app/
Beta Was this translation helpful? Give feedback.
All reactions