【发布时间】:2014-12-18 13:30:16
【问题描述】:
在 React JSX 中似乎不可能做这样的事情:
render: function() {
return (
<{this.props.component.slug} className='text'>
{this.props.component.value}
</{this.props.component.slug}>
);
}
我得到一个解析错误:Unexpected token {.这不是反应吗 可以处理吗?
我正在设计这个组件,以便在后台,this.props.component.slug 中存储的值将包含有效的 HTML 元素(h1、p 等)。有什么办法可以做到吗?
【问题讨论】:
标签: javascript reactjs