hydration the initial UI does not match what was rendered on the server with next-theme

big time next js noobie here, using next theme as my dark/light mode solution and it keeps giving me this error. my code:
7 Replies
kdiffin
kdiffin2y ago
also tried solving it like this, but it only works partially as the value for theme can be either "light" or "dark" depending on whats stored on localstorage.
niels
niels2y ago
That error is usually because of invalid html
kdiffin
kdiffin2y ago
it works when i remove that conditional
benten
benten2y ago
This is happening because you're rendering one theme on the server and another in the browser you need to render the same theme in both the server and browser
kdiffin
kdiffin2y ago
how can i do this?
benten
benten2y ago
Don't use those conditionals
kdiffin
kdiffin2y ago
alright
Want results from more Discord servers?
Add your server