使用dangerouslySetInnerHTML
const element = (<div dangerouslySetInnerHTML={{__html:"<h1>hello,this is react</h1>"}} />);
ReactDOM.render(
element,
document.getElementById('example')
);
使用dangerouslySetInnerHTML
const element = (<div dangerouslySetInnerHTML={{__html:"<h1>hello,this is react</h1>"}} />);
ReactDOM.render(
element,
document.getElementById('example')
);
HTML字符实体(Character Entities),转义字符串(Escape Sequence) 为什么要用转义字符串?HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用。这些符号是不显示在我们最终看到的网页里的,那如果我们希望在网页中显示这些符号,该怎么办呢? 这就要说到HTML转义字符串(Escape Sequenc
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M