JSFiddle - React, Tailwind, and code Playground

HTML

<button type="button" onClick = "check_this_out()">Show/hide</button>

<div id="the_text"> I want to hide this by pressing the button above</div>

CSS

#the_text {
    visibility: hidden;
}

JavaScript

function check_this_out() {
    var vis_or_hidden = document.getElementById("the_text");

    if (getComputedStyle(vis_or_hidden)["visibility"] == "hidden")
    {
        vis_or_hidden.style["visibility"] = "visible"
    } else
    {
        vis_or_hidden.style["visibility"] = "hidden"
    }
}