Avoid hydration mismatch with viewport width
Hello everyone,
I need some advice, I sometimes have to render a different component depending on the size of the viewport.
e.g.
In a case like this, if the viewport is already larger than 1024px, there is no problem, because between server and client the template remains the same. But of course, if I reload the page with a size smaller than 1024px, the hydration mismatch warning appears in the console. Do you have any suggestions for me other than to use the ClientOnly component?
Thank you all!
0 Replies