mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Extracted "safe taint" in docs/homepage to align with best practice #4212
This commit is contained in:
1 parent
56ccd82374
commit
52d8d3b2ff
2 files changed
+10
-5
No files matched your search
@@ -257,14 +257,18 @@ That's React protecting you from an [XSS attack](https://en.wikipedia.org/wiki/C
|
||||
```javascript{4,10}
|
||||
// tutorial7.js
|
||||
var Comment = React.createClass({
|
||||
render: function() {
|
||||
rawMarkup: function() {
|
||||
var rawMarkup = marked(this.props.children.toString(), {sanitize: true});
|
||||
return { __html: rawMarkup };
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div className="comment">
|
||||
<h2 className="commentAuthor">
|
||||
{this.props.author}
|
||||
</h2>
|
||||
<span dangerouslySetInnerHTML={{"{{"}}__html: rawMarkup}} />
|
||||
<span dangerouslySetInnerHTML={this.rawMarkup()} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user