The Implications of DangerouslySetInnerHTML in React

Victoria Lo
4 min readSep 28, 2020

Hello everyone! In this article, I shall explain what dangerouslySetInnerHTML is in React and how to use it safely. Let's begin!

The React framework is known to have adopted a browser-independent DOM system, which means it does not interact with the DOM directly. And so in React, you will notice that you are not allowed to add HTML strings directly. For example:

--

--

Victoria Lo

A nerd in books, tea and programming. I publish weekly on my personal blog: https://lo-victoria.com/