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
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.
That error is usually because of invalid html
it works when i remove that conditional
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
how can i do this?
Don't use those conditionals
alright