.js
字符串标签输入需要使用 dangerouslySetInnerHTML={{__html:你好输入的字符串}}
.html
<div id="example"></div>
<script type="text/babel">
class Maa extends React.Component{
constructor(props){
super(props)
this.state={
newhtml:"<p>haha</p>"
}
}
render(){
return(
<div dangerouslySetInnerHTML={{__html:this.state.newhtml}}></div>
)
}
}
ReactDOM.render(<Maa/>,document.getElementById("example"))
</script>