JSFiddle - React, Tailwind, and code Playground

HTML

<div id="nav">
    <a href="#content1">Show content 1</a>
    <a href="#content2">Show content 2</a>
    <a href="#content3">Show content 3</a>
</div>

<div id="contents">
    <div id="content1" class="toggle">show the stuff1</div> 
    <div id="content2" class="toggle">show the stuff2</div>
    <div id="content3" class="toggle">show the stuff3</div>
</div>

CSS

#contents {
    width: 200px;
    height: 40px;
    border: dotted;
    margin-top: 20px;
}
.toggle { display: none; }

JavaScript

$("#nav a").click(function(e){
    e.preventDefault();
    $(".toggle").hide();
    var toShow = $(this).attr("href");
    $(toShow).show();
}).filter(":first").click();