动态渲染React组件

动态渲染React组件,第1张

动态渲染React组件

您不应该将组件子d放在花括号中:

var Hello = React.createClass({    render: function() {        return <this.props.component.slug className='text'> {this.props.component.value}        </this.props.component.slug>;    }});React.renderComponent(<Hello component={{slug:React.DOM.div, value:'This is my header'}} />, document.body);

这是一个有效的小提琴:http :
//jsfiddle.net/kb3gN/6668/

此外,您还可以找到JSX编译器,有助于调试此类错误:http : //facebook.github.io/react/jsx-
compiler.html



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4886879.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-11

发表评论

登录后才能评论

评论列表(0条)

    保存