Is there a way to ignore the hydration mismatch and let the mismatched code to go to the client?
So I currently have configured ISR using Next.js and came up with the hydration problem. Right now, everything is working like this:
- the开发者_运维问答 page is prebuilt on the server;
- when user loads on the page, the server is injecting the source code of the page with some additional HTML to the DOM;
- when the page is served to the user, hydration starts, which detects mismatch between initial render and the pre-rendered source (with injected HTML), and switching to client side rendering.
- after that, the HTML that was added on the server is removed, which is the issue.
Is there a way to wrap this HTML code in some specific container and make React ignore it during the hydration, so this code make through it and displays on the page?
I've tried adding suppressHydrationWarning
to the containers where this HTML was injected, but it didn't work.
Is it possible to implement something like that?
精彩评论