Next.js Discord

Discord Forum

Stylesheet of one page remaining in redirected page

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
I have a login page. When a user is logged in he is redirected to another page from the login page (say dashboard page). But the css stylesheet of login page is remaining in dashboard page too. However if I refresh the dashboard page it will be fixed and login page styles will not be applied.
It's caching I guess?(I'm new to nextjs and react) How can I resolve this problem.

Additional information if it's helpful:
I added stylesheets by importing them using import statement.
I also tried using next/head by wrapping the stylesheets in it.
Also note that I'm using "use client" in both login and dashboard page.
Also I'm using app directory. (I checked the documentation it didn't have next/head in app directory documentation. Is it not supported yet?)

0 Replies