我正在使用 ReactHtmlParser 并返回字符串作為 html 標簽JavaScript_Lessons_Objects.jsfunction JavaScriptLessonObject() { const one = "Robby "; return ( [ { title: [<div><p className={jsStyle.title}>Overview</p></div>], }, { titleName: "JS Output", iconName: faDotCircle, description: [ <span className={jsStyle.yourClass}>{one}</span>, `<p> advanced diverted domestic sex repeated bringing you old. </p>` ], }, ] );}課程.jsx<div className={less.description}> <p> { ReactHtmlParser(this.props.lesson[this.state.indexDescription]["description"]) } </p></div>請注意,除了該行之外,我使用<span className={jsStyle.yourClass}>{one}</span>它采用名稱“Robby”的質量,但我得到的不是名稱 [object Object],https://ibb.co/GWGWMZ2 但是當我刪除 ReactHtmlParser 即this.props.lesson[this.state.indexDescription]["description"]我獲取名稱https://ibb.co/6b3YVzc但正如您所理解的,該行內的 html 標簽不起作用
React - ReactHtmlParser 返回一個 [object Object]
SMILET
2023-10-14 18:11:07