Skip to content

React Hydration Error #72

@amirardalan

Description

@amirardalan

Blog pages using react-syntax-highlighter with markdown formatted in the language of typescript or TSX output console UI Hydration errors after the page is refreshed.

The issue does not occur with other languages such as bash or markdown.

Loading the Markdown component dynamically with SSR disabled fixes this common Next.js hydration issue. The tradeoff is the UX and performance is much worse.

I suspect there may be an issue with the Prism language library for TSX and TS themselves since this issue does not exist for any other language. The error also only happens if the user manually refreshes the page after first load.

As far as I can tell, there is no actual impact from this console error on the performance or UX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions