{this.isPay && <PaidOverlay content={ dangerouslySetInnerHTML={{ __html: <p>test</p> }} } />}
What is wrong here? Got unexpected token
这有什么不对?得到意外的令牌
2
Not exactly sure what you're trying to achieve but you are certainly using dangerouslySetInnerHTML
wrong here. It is a prop and should be at the same level as content
不完全确定你想要实现什么,但你肯定在这里使用危险的SetInnerHTML错误。它是一个道具,应该与内容处于同一水平
Otherwise you should do
否则你应该这样做
{this.isPay && <PaidOverlay content="<p>test</p>" /> }
And
和
class PaidOverlay {
render() {
return <div dangerouslySetInnerHTML={{ __html: this.props.content }} />
}
}
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2017/07/25/e7267008efe4e514ec9f13eda5df24cf.html。