← Quiz: XSS: all 10 questions
Quiz: XSS · Question 3 of 10
In React, which is dangerous with user input?
In React, which is dangerous with user input?
- A.{comment.text}
- B.dangerouslySetInnerHTML={{ __html: comment.text }}
- C.<p>{comment.author}</p>
- D.useState(comment.text)
Answer & explanation
Correct answer: dangerouslySetInnerHTML={{ __html: comment.text }}
React escapes {...} automatically; dangerouslySetInnerHTML inserts raw HTML.
Can you get the rest right without peeking?
Take the timed Quiz: XSS quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →