I'd like to render MDX content directly from list that is being returned from allMdx
query. I'm using 'gatsbyjs' with 'gatsby-plugin-mdx'.
Let's have a query:
export const query = graphql`
query MyQuery {
allMdx {
nodes {
id
body
frontmatter {
title
slug
}
}
}
}
`;
As can be seen in official documentation https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#updating-page-templates <MDXRenderer>
component was removed. So it's no longer possible to do such thing as:
{data.allMdx.nodes.map((n) => (
<MDXRenderer>{n.body}</MDXRenderer>
))}
Instead now it is required to do it in that way:
function MyComponent({ children }) {
return (
<div>
{children}
</div>
);
}
But I'd like to render MDX from allMdx
so that I have a list of MDX posts for example, do you know guys whether it is possible and how to do it?