在 React JSX 中,似乎不可能做到这一点:
render: function() {
return (
<{this.props.component.slug} className='text'>
{this.props.component.value}
</{this.props.component.slug}>
);
}
我得到一个解析错误: 意外的令牌{ 可以处理?
我正在设计这个组件,以便在底层,存储在 this.props.component.slug
中的值将包含有效的 HTML 元素(h1、 p 等)。有办法解决吗?