Hydration Failed Error in Next.js: Mismatch Between Server and Client Rendered HTML

Hello fellow developers, I've been working on a Next.js application, and I've encountered a "Hydration Failed" error that I'm struggling to resolve. The issue arises when the initial UI rendered on the server doesn't match what's rendered on the client, particularly when dealing with small screen sizes. This Code is to render some Initial items on the left that you can click on and see a detailed view on the right(not implemented yet). On small screens I want to just redirect to the details page for that particular item instead.
9 Replies
Neto
Neto•16mo ago
on server, isSmallScreen will always be true on client, when it runs isSmallScreen is false that is the reason for the mismatch
tropic
tropicOP•16mo ago
Oh shit you right
tropic
tropicOP•16mo ago
Fixed, for the people who may stumble upon this here you go
tropic
tropicOP•16mo ago
I see you are fulfilling your DevRel Role 🙂
Neto
Neto•16mo ago
t3ggSip
tropic
tropicOP•16mo ago
I havent really been in react/next js land in a while been spending too much time in theoDisgusted
Neto
Neto•16mo ago
i take react over dotnet any day of the week
tropic
tropicOP•16mo ago
I dont really like front end anyways I just dont wanna be doing front end shit mainly lol Thanks Nyx
Neto
Neto•16mo ago
lmao np
Want results from more Discord servers?
Add your server