Haloo, hope you have a great day!
I'm in the middle of learning something about markdown on react, i already success using react markdown editor, but now, when i want to display it, i got stuck, i'm using react-markdown
and NEXTJS
, and here's the problem:
importing the library
:
const ReactMarkdown = dynamic(
() => import("react-markdown").then((mod) => mod.default),
{ ssr: false }
);
const rehypeRaw = dynamic(
() => import("rehype-raw").then((mod) => mod.default),
{ ssr: false }
);
const remarkGfm = dynamic(
() => import("remark-gfm").then((mod) => mod.default),
{ ssr: false }
);
i have markdown look like this:
const [value, setValue] = useState("# A demo of `react-markdown`");
and this is my div
<div className="container mx-auto px-0 lg:px-40 pt-6 pb-8 sm:pt-14 sm:pb-16 md:pt-14 md:pb-16 min-h-screen">
<ReactMarkdown
children={value}
remarkPlugins={[remarkGfm]}
/>
</div>
and when i refresh my page, i got this:
that's not H1
, and the code tag
seems didn't work, BUT when i'm using bold:
const [value, setValue] = useState("# A **demo** of `react-markdown`");
the bold is being display..
and at this point, idk why this happend, can somebody help me?