Skip to content

Next.js Hydration error with inline tags #188

@mfix-stripe

Description

@mfix-stripe

Discussed in #185

Originally posted by khash August 26, 2022
Using NextJS

I'm trying to build a "hint" tag, similar to this from https://stripe.com/docs/connect/collect-then-transfer-guide

image

This component, should be usable within any text (like in code) and accept anything as the content of the popover (links, images, etc).

I think this is a simple use case and below is how I've reproduced it. I've removed all code that does that for simplicity in the question:

// hint.markdoc.js
export default {
  attributes: {
    caption: { type: String },
  },
  render: ({ caption, children }) => <div><span>{caption}</span><span>{children}</span></div>,
};
// test.md
This is a {% hint caption="hint"%}generated by the tag{% /hint %} as an example

This throws a NextJS Hydration error https://nextjs.org/docs/messages/react-hydration-error.

However the same code with the following works fine:

This is a 
{% hint caption="hint"%}
generated by the tag
{% /hint %}
as an example

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnext.jsquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions