I have a componet which used in mdx files The problem is that the content in the componet is rendered as text but I want to render them as mdx. This is how mdx file look likes:
---
title: Topic 1
---
<Notice> Notice **Two** with link [link](https://angular.io/) </Notice>
outside look: Notice **Two** with link [link](https://angular.io/)
And this is the Notice component
import React from "react";
const Notice = ({ children, type }: { children: any; type?: string }) => {
return (
<div style={{ border: "2px solid dodgerblue" }}>
<p>{type}</p>
<div>{children}</div>
</div>
);
};
export default Notice;
And also this is the code of root file:
import * as React from "react";
import { MDXRenderer } from "gatsby-plugin-mdx";
import { MDXProvider } from "@mdx-js/react"
import Notice from './notice/notice';
export default function ({ docName, title, body, slug }) {
const shortcodes = {Notice};
return (
<div style={gridWrapper}>
<article>
<h1>{title}</h1>
<div>
<MDXProvider components={shortcodes}>
<MDXRenderer>{body}</MDXRenderer>
</MDXProvider>
</div>
</article>
</div>
);
}
Any idea how to fix this issue?