React·100 questions

When to use dangerouslySetInnerHTML and how to do it more safely?

Answer
Use only if rendering HTML (markdown).
Sanitize content.
Limit supported tags.
Avoid inline scripts and event handlers.
Think about CSP.
Was this answer helpful?

More questions in this topic

Related questions from other topics