Skip to content
Discussion options

You must be logged in to vote

Once you've fetched the MDX string from your database, you can pass it to the MDXRemote component like this:

import { MDXRemote } from 'next-mdx-remote/rsc'
 
export default async function Page() {
  // ...fetch MDX from MongoDB

  return <MDXRemote source={mdxString} />
}

If you have custom components you'd like to use, you can pass them to the same MDXRemote component via the components prop

I recommend looking into this section of the NextJS MDX documentation if you're still confused.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@LinguiniThePasta
Comment options

Comment options

You must be logged in to vote
2 replies
@wooorm
Comment options

@LinguiniThePasta
Comment options

Answer selected by LinguiniThePasta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants