Web Security · Junior · Question 21 of 75

Why is rendering {comment.text} in JSX safe from XSS by default?

Explanation

React sets text through the DOM as text nodes. Markup in the string is shown literally instead of being parsed.

Further reading

Problem with a question

Web Security · Junior · question 21

Test yourself

Take the Web Security · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz