nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

react/Security

Where React's defaults protect you, and where they don't.

10 QuestionsAdvancedHigh Priority ~12 min read

React escapes any value rendered as JSX content by default, which is why {userInput} rendered as text is safe even if that input contains HTML-looking characters — React treats it as plain text rather than parsing it as markup. That protection has one explicit, deliberately named opt-out: dangerouslySetInnerHTML bypasses escaping entirely and injects raw HTML, and the intentionally alarming name is meant to make you stop and think before reaching for it.

React's default escaping doesn't cover everything, though. A URL built from unsanitized user input and used in an href or src can still enable a javascript: URI injection, since that's not something JSX's text-escaping addresses. Third-party components or libraries that use dangerouslySetInnerHTML internally can reintroduce the same risk in code you don't directly control. And React apps still need everything any other web app needs — sanitizing data before it's stored, validating on the server since client-side validation can always be bypassed, and being deliberate about exactly what data an API sends down to the client in the first place.

What you'll walk away knowing

Why {value} in JSX is safe from XSS by default, and exactly what 'escaping' means here
What dangerouslySetInnerHTML bypasses, and when (rarely) it's actually necessary
How javascript: URI injection can still happen through href/src even with React's default escaping
Why client-side validation is a UX nicety, not a security boundary, and why server-side checks are still required
1What are the major xss threats in react and how to prevent them?Intermediate
All Topics
1
Basics
JSX
State and Props
Components
Function Components
2
Virtual DOM
Reconciliation
Class Components
Lifecycle functions
3
Hooks
useState
useReducer
useMemo
useContext
useCallback
useEffect
Custom Hooks
New Hooks
4
Code Sharing
HOC
Refs
Data Sharing
Events
Context API
5
Redux
Router
CSR-SSR
React APIs
ReactDOM
Strict Mode
6
Performance Optimisation
Security
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.