question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Hydration failed because the initial UI does not match what was rendered on the server.

See original GitHub issue

Hi all! I have this issue using this lib with React 18.

My libs:

{
    "next": "12.1.6",
    "next-mdx-remote": "^4.0.3",
    "react": "18.1.0",
    "react-dom": "18.1.0",
}

Any solution?

Снимок экрана 2022-06-15 в 10 13 49

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BRKalowcommented, Jun 17, 2022

I agree! Unfortunately these errors are coming directly from React, so there is not a ton we can do in this library.

1reaction
Geliocommented, Jun 17, 2022

Yes, you are right about the spec, that’s definitely invalid. The error message is slightly perplexing though and the console errors do not help diagnose the problem.

Here is the DOM hierarchy I got when the page was server-side rendered and I had JavaScript enabled: image

Most errors in the console look like this:

image

In the middle of the console errors there is a buried error message explaining the root of the problem:

image

What would help is making the error message for the actual cause more prominent, or making it appear as one of the first/last errors logged to the console. Right now it appears in the middle of the list of 19 errors, 18 of which are the same.

I’m suggesting what would make issues like these one easier to debug without looking for help online. I don’t expect any changes, just offering suggestions

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hydration failed because the initial UI does not match ... - GitHub
It's likely that you have a mismatch between the server output and the client. Before React 18, you'd only get an error in...
Read more >
React 18: Hydration failed because the initial UI does not ...
I have been experiencing the same problem lately with NextJS and i am ... the initial UI does not match what was rendered...
Read more >
react-hydration-error - Next.js
The first render is called Hydration which is a feature of React. ... a prop there is no mismatch between what was rendered...
Read more >
Solved: Hydration failed because the initial UI does not match ...
As the error suggests, this problem occurs when the HTML from the server does not match what the client-side is trying to render....
Read more >
Hydration failed because the initial UI does not ... - YouTube
Hydration failed because the initial UI does not match what was rendered on server - error. Watch later. Share. Copy link.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found