JSFiddle - React, Tailwind, and code Playground
HTML
<div id="myDiv">
<p>THIS IS MY DIV AND A PARAGRAPH</p>
</div>
<button type="button" onclick="hide();">Press to hide</button>
<button type="button" onclick="unhide();">Press to unhide</button>
JavaScript
function hide(){
document.getElementById("myDiv").setAttribute("hidden","");
}
function unhide(){
document.getElementById("myDiv").removeAttribute("hidden");
}