What security issues should a React developer think about?
Model answer
XSS is the main one: React escapes values in JSX by default, but dangerouslySetInnerHTML, unsafe URLs (javascript: links) and third-party scripts can reintroduce it, so sanitise HTML with a library such as DOMPurify. Also: never put secrets in client code (everything shipped is public), keep dependencies updated, use a content security policy, and rely on the server for authorisation.
Learn this topic
React 19 New Features: Actions, useActionState, useOptimistic, use and More in the course React.js Full Course: Beginner to Advanced.
Sign in to add your own answer.
More questions
- What are React Server Components, in simple terms?
- What is the difference between client-side rendering, server-side rendering and static generation?
- What are error boundaries and how do you use them?
- What are portals and when do you use them?
- What is new in React 19 that a developer should know?
- How would you structure folders and code in a large React project?