Skip to content

Warning with next-mdx-remote and Blocks. Warning: React.jsx: Static children should always be an array. #433

Closed
@stern-shawn

Description

@stern-shawn

Expected

Using codehike in conjunction with next-mdx-remote (as before in v0.9), I can create a custom component and annotate some "blocks" using the new Code Hike syntax and have a warning-free experience.

Result

When using a project with next-mdx-remote and trying to use a custom component with blocks, such as this one from the examples doc:

<MyComponent>

The Brandybuck Brunch

## !!breakfasts first

Grilled mushrooms

## !!breakfasts second

Apple pancakes

</MyComponent>

I get the following warnings in my console:

Warning: React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.
    at MDXContent (eval at <anonymous> (file:///Users/sstern/trashfire/docs/node_modules/next-mdx-remote/dist/index.js:37:35), <anonymous>:2162:8)
    at MDXProvider (file:///Users/sstern/trashfire/docs/node_modules/next-mdx-remote/node_modules/@mdx-js/react/lib/index.js:70:18)
    at MDXRemote (file:///Users/sstern/trashfire/docs/node_modules/next-mdx-remote/dist/index.js:12:29)
...

The behavior seems to happen regardless of using single blocks or lists, etc.

As always, thank you for the amazing library ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions