DEV Community

Discussion on: Making MDX blog with Nextjs - Part 2

Collapse
 
muuhoffman profile image
Matthew Hoffman

With the current version of next-mdx-remote you have to use

// ./blog/[slug].js

export async function getStaticProps({ params }) {
  ...
  const mdxSource = await serialize(content, {
    components,
    scope: data,
  });
  ...
}

export default function Posts({ source, frontMatter }) {
  return (
    <>
      ...
      <MDXRemote {...source} components={components} />
      ...
    </>
  );
}
Enter fullscreen mode Exit fullscreen mode