Firebaseから取得したコンテンツを使用してinnerHtmlを設定するPostコンポーネントがあります。Firebaseから取得したhtml文字列内に埋め込み要旨を生成する - 反応
render() {
return (
<Panel>
<Image src={this.state.img} alt={this.state.title} />
<h2>{this.state.title}</h2>
<p className='date'>{this.state.name}</p>
<div className='text' ref='post'>
<div dangerouslySetInnerHTML={{__html: this.state.content}} />
</div>
</Panel>
)
表示される内容は、次のようなfirebaseに格納されます。
{
"id": 11,
"title": "The Earth",
"slug": "the-lazy-mans-guide-to-anything-about-princess",
"img": "https://hd.unsplash.com/photo-1467321638755-7246fd0dc1f3",
"summary": "<p>In as name to here them deny wise this. As rapid woody my he me which. Men but they fail shew just wish next put. Led all visitor musical calling nor her. Within coming figure sex things are. Pretended concluded did repulsive education smallness yet yet described. Had country man his pressed shewing. No gate dare rose he. Eyes year if miss he as upon.</p>",
"content": "<p>In as name to here them deny wise this........
しかし、リアクトは、「コンテンツ」内のスクリプトタグを評価しませんので、私はその要旨を埋め込むことはできません。私はいくつかの選択肢を試しましたが、提案を探しています。