JSFiddle - React, Tailwind, and code Playground
HTML
<div>
</div>
JavaScript
/*
Because the input variable here is plain text we can't write
< / script > directly, but an attacker won't need the trick
we use below to overcome that.
*/
var input = "<"+"script>alert('hello');"+"<"+"/"+"script>";
$(input).appendTo("body");