React - How to pass HTML tags in props?

前端 未结 20 1290
甜味超标
甜味超标 2020-12-07 11:58

I want to be able to pass text with HTML tags, like so:

not working.\" />

Bu

20条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 12:27

    Have appended the html in componentDidMount using jQuery append. This should solve the problem.

     var MyComponent = React.createClass({
        render: function() {
    
            return (
               
    ); }, componentDidMount() { $(ReactDOM.findDOMNode(this)).append(this.props.text); } });

提交回复
热议问题