If we have to insert normal html elements with React Variables in JSX, it is easy, We can use dangerouslySetInnerHTML, or we can use any npm packahe html-react-parser.
Below code works fine.
const thisIsMyCopy = '<p>copy copy copy <strong>strong copy</strong></p>';
render: function() {
return (
<div className="content" dangerouslySetInnerHTML={{__html: thisIsMyCopy}}></div>
);
}
But If we try to add any Link element inside the html, It do not convert into anchor tag.
const thisIsMyCopy = '<Link to="/button" >button</Link>';
If we inspect this element, this does not shows as anchor tag, Below is the Sandbox example for this.
https://codesandbox.io/embed/react-example-y5m94?fontsize=14&hidenavigation=1&theme=dark I hope, many of you react developer must have