What do you want to get from marked(text) otherwise than text?
If text is in markup language the result should be the formated text.
Did you see the example at https://github.com/markedjs/marked ?:
<script>
document.getElementById('content').innerHTML =
marked('# Marked in the browser\n\nRendered by **marked**.');
</script>
I don’t know why it shows the html tags instead of the formatted text. I have done this project last year with jquery, no react. And I am a bit rusty with react, need more practice, review many things.
You would need to set the innerhtml. Marked returns a string , if you just place this inside a tag in react it will display the text. To get it to render on the page you need to do something like this:
function createMarkup() {
return {__html: 'First · Second'};
}
function MyComponent() {
return <div dangerouslySetInnerHTML={createMarkup()} />;
}