Hacker News new | ask | show | jobs
by nicoburns 1949 days ago
The point of `dangerouslySetInnerHTML` is also to highlight an area which requires more human attention. It's perfectly safe if you have otherwise handled escaping or validation of the content. It's just that you want to pay careful attention to that code to ensure that you're doing it correctly, whereas in normal React code you don't have to think about escaping at all because the runtime handles it for you.

Likewise `unsafe` marks areas where you need to be really careful that you upholding the safety invariants yourself, whereas in normal Rust code you don't need to think about that at all.