Question · JavaScript and React course · Module 10: React Ecosystem and Future

XSS in React - Protection

How does React protect against XSS (Cross-Site Scripting) attacks by default?

Answer options

  • Encrypts all HTML code before sending it to the browser
  • Blocks all external JavaScript scripts
  • Automatically escapes values in JSX, converting special HTML characters into safe entities
  • Removes all event attributes (onClick, onSubmit) from DOM elements

You can check the correct answer by solving this task in the CodeWorlds game.