reactjs render html string code example
Example 1: string to html javascript react
import React from 'react';
import { Markup } from 'interweave';
const articleContent = "Lorem ipsum dolor laboriosam.
Facere debitis impedit doloremque eveniet eligendi reiciendis ratione obcaecati repellendus culpa? Blanditiis enim cum tenetur non rem, atque, earum quis, reprehenderit accusantium iure quas beatae.
Lorem ipsum dolor sit amet this is a link, click me Sunt ducimus corrupti? Eveniet velit numquam deleniti, delectus
- reiciendis ratione obcaecati
- repellendus culpa? Blanditiis enim
- cum tenetur non rem, atque, earum quis,
reprehenderit accusantium iure quas beatae."
// this will take the articleContent string and convert it to HTML markup. See: https://milesj.gitbook.io/interweave
Example 2: how to use renderto string
ReactDOMServer.renderToString(element)