reactjstinymcereact-hooks

Display TinyMCE Content in React


As per title, what I'm trying to achieve is to display the Wysiwyg content from the Editor to another component.

I created a sample on codesandbox here: https://codesandbox.io/s/boring-tharp-zwflu

As you can see, the editor works fine and is returning the values as it should.

My issue here is I'm not able to convert that String I get returned, into JSX tags.

I did a deep search, but couldn't find anything related.

Thank you in advance for your time and help!


Solution

  • You have to install npm i react-html-parser import it to your component import ReactHtmlParser from "react-html-parser";"; and render it

    <div className="wysiwyg">
    {ReactHtmlParser(wysiwyg)}
    </div>