React.js Dangerously Set innerHTML 不合时宜的使用innerHTML可能会导致cross-site scripting (XSS)攻击。 净化用户的输入来显示的时候,经常会出现错误,不合适的净化也是导致网页攻击的原因之一。 我们的设计哲学是让确保安全应该是简单的,开发者在执行“不安全”的操作的时候应该清楚地知道
After you fully understand the security consequences and properly sanitize any HTML data you want to insert, here is an example of how to use it in your React code: React.js Copy importReact,{Component}from"react"render(){return(<divdangerouslySetInnerHTML={{__html:"<p>Your html code her...
Find out how I solved the error "`dangerouslySetInnerHTML` did not match", in a React application