Skip to content
Discussion options

You must be logged in to vote

AHa yeah HTML is kind of forgiving, but not... like you can't nest p tags in server sent HTML at least, and yeah in general weird things may happen when the browser HTML parser re-orders the HTML into a valid shape.

It is not Next.js making decisions about this btw, React does some validation, but it is not complete, acknowledged in the source code of React. Since you are sending invalid HTML in the dangerouslySetInnerHTML bit, all guards are off - the browser parser re-arranges the HTML and React runs into hydration issues, possibly leading duplicate nodes, or nodes in unexpected places.

See here, I did this in a codepen project. Notice the output is not what you'd expect. This tool is a…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@IsKaros
Comment options

@icyJoseph
Comment options

@IsKaros
Comment options

@icyJoseph
Comment options

Answer selected by IsKaros
@IsKaros
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants