javascript 如何使用来自API的HTML标记并显示在页面上?

hec6srdp  于 12个月前  发布在  Java
关注(0)|答案(1)|浏览(91)


的数据

<p>This is one of the most accurate answers that is able to resolve the birthday of 29th of Feb compared to any year of 28th Feb.
</p>\n\n
<pre class=\ "lang-cs prettyprint-override\">
  <code>public int GetAge(DateTime birthDate)\n

字符串
我想在我的答案显示页面上开发,并使用此标签从API的建设页面。

r55awzrz

r55awzrz1#

请参阅ReactJS危险地设置了内部html

import React from 'react';
import { render } from 'react-dom';
const htmlString = '<h1>Hello World! 👋</h1>';
const App = () => (
   <div dangerouslySetInnerHTML={{ __html: htmlString }} />
);
render(<App />, document.getElementById('root'));

字符串
祝你好运

相关问题