Reputation: 1141
I'm using nextjs with typescript and react-jss. I get the error:
Warning: Prop `className` did not match. Server: "mobileNavToggle-0-2-10" Client: "mobileNavToggle-0-2-2"
I think this is caused because the SSR and hydration produce different class names. This only seems to happen when I reload the page manually, not when next automatically reloads the page. How can I fix this?
Upvotes: 3
Views: 2781
Reputation: 7536
I fixed this problem adding a _document.js
like in the with-react-jss
example:
https://github.com/vercel/next.js/blob/master/examples/with-react-jss/pages/_document.js
Upvotes: 2