Skip to content

Setting content of <ReactMarkdown> element #1199

Closed Answered by ChristianMurphy
chill31 asked this question in Q&A
Discussion options

You must be logged in to vote

Okay,
As a general React note, I'd highly recommend avoiding modifying React managed content using manual DOM selectors.
It can cause conflicts, overrides, and unexpected renders.

If you need to modify something inside the content React manages, use a component (potentially using Context or another state manager to cross multiple layers), to allow any updates to be managed by React, avoiding the above potential issues with direct DOM manipulation.

The way to do that in content within react-markdown is with the components prop and using directives.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@chill31
Comment options

@ChristianMurphy
Comment options

Answer selected by chill31
@chill31
Comment options

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