WTF WTF -5 years ago 305
JSON Question

Get HTML in JSON to render as HTML in React Component

Trying to figure out how can i get the link to actually render as a link. Right now after i read this line of text from my Json file, react renders the hyperlink as literal text, it doesn't render it as a link.


"about": "John has a blog you can read <a href=\"\" target=\"_blank\">here</a>."


const Person = Component({
store: Store('/companies'),
var company =[this.props.companyId];

return (
<div id='ft-interviewee className="all-100"'>
<p className="section-heading bold padding-top-20 font-22">Person</p>
<div className="column-group horizontal-gutters">
<div className="all-10">


Answer Source

You can use dangerouslySetInnerHTML

<div dangerouslySetInnerHTML={ { __html: company.people.person.about } }></div>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download