2 回答
TA贡献1993条经验 获得超5个赞
我不确定如何标记为重复,
基本上你想将字符串呈现为 HTML,这是一种危险的做法,所以要小心。
const x = {
titleName: "Indorction",
heading: 'Welcome to JavaScript',
iconName: faDotCircle,
description: [
`
Do we even need to introduce <p>HTML element</p>? It’s one of the most popular programming
languages on the planet!
Ever visited a website that made you think…"Hey, this website is really cool and
`
],
},
在你的渲染函数中:
<div dangerouslySetInnerHTML={{ __html: x.description }}></div>
TA贡献2080条经验 获得超4个赞
JavaScript_Lessons_Objects.js
{
titleName: "Indorction",
heading: 'Welcome to JavaScript',
iconName: faDotCircle,
description: [
`
Do we even need to introduce <b class="hal">JavaScript</b>? It’s one of the most
popular programming languages on the planet!.
`
],
},
课程.jsx
{ReactHtmlParser(this.props.lesson[this.state.indexDescription]["description"])}
添加回答
举报