Is there any “behind the scenes” difference from setting an element’s innerHTML vs setting the dangerouslySetInnerHTML property on an element? Assume I’m properly sanitizing things for the sake of simplicity.
Example:
var test = React.createClass({
render: function(){
return (
<div contentEditable="true" dangerouslySetInnerHTML={{ __html: "Hello" }}></div>
);
}
});
vs
var test = React.createClass({
componentDidUpdate: function(prevProp, prevState){
this.refs.test.innerHTML = "Hello";
},
render: function(){
return (
<div contentEditable="true" ref="test"></div>
);
}
});
I’m doing something a bit more complicated than the above example, but the overall idea is the same