Skip to content

How to render mdx from a constant using custom components? #2455

Answered by ChristianMurphy
elVengador asked this question in Q&A

You must be logged in to vote

I tried the evaluate function, but I dont know how to pass my custom components

the default return from evaluate, is a react component.
When you render it on the page, pass that component a components={} prop.

<MDXProvider components={components}>

avoid using Provider when possible, it is more complex than is needed in most cases.

Replies: 2 comments 4 replies

You must be logged in to vote
1 reply
@elVengador

You must be logged in to vote
3 replies
@elVengador

@ChristianMurphy

Answer selected by elVengador
@elVengador

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