JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

var entityMap = { // Lista de entidades
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    '"': '&quot;',
    "'": '&#39;',
    "/": '&#x2F;'
  };

  function escapeHtml(str) {
    return String(str).replace(/[&<>"'\/]/g, function (s) {
      return entityMap[s];
    });
  }

var s = escapeHtml("<div>oi</div>");
console.log(s);