How to add style to React Element if it's created this way?

前端 未结 2 1225
天涯浪人
天涯浪人 2021-01-07 19:07
var MyElement = React.createClass({displayName: \"FormatParagraph\",
    render: function () {
        return (
            React.createElement(\"p\", null, this.pro         


        
2条回答
  •  执笔经年
    2021-01-07 19:39

    React.createElement("p", {id : 'div1', className : 'news'}, this.props.paragraph)
    

    This way you can use CSS specified in App.css inside in an id/class.

提交回复
热议问题