JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="hide()">Click</button>
<div id="block">
Something
</div>
<script>
function hide() {
var x = document.getElementById("block");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
CSS
#block {
width: 100%;
padding: 50px 0;
text-align: center;
background-color: lightblue;
margin-top: 20px;
}