Error: Hydration failed because the initial UI does not match what was rendered on the server.
See original GitHub issueHi 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?
Issue Analytics
- State:
 - Created a year ago
 - Comments:7 (3 by maintainers)
 
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I agree! Unfortunately these errors are coming directly from React, so there is not a ton we can do in this library.
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:
Most errors in the console look like this:
In the middle of the console errors there is a buried error message explaining the root of the problem:
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