React security and best practices
Safe React code avoids dangerous HTML injection, unnecessary direct DOM manipulation, state mutation, and side effects during render.
- `dangerouslySetInnerHTML` is risky
- Keep components focused and state colocated
- Avoid premature optimization and hidden mutation
React security and best practices