What is XSS and how do you prevent it in a MERN app?
Model answer
Cross-site scripting injects malicious script into a page. React escapes values by default, so avoid dangerouslySetInnerHTML (or sanitise with DOMPurify), validate and encode user content, use a content security policy, and keep tokens out of places scripts can read when possible.
Learn this topic
Login with JWT: Sign In, Issue a Token and Avoid Timing Leaks in the course MERN Stack Full Course: MongoDB, Express, React and Node.js.
Sign in to add your own answer.