JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
    <li><a href="#">Content 1 should open</a></li>
     <li><a href="#">Content 2 should open</a></li>
     <li><a href="#">Content 3 should open</a></li>
     <li><a href="#">Content 4 should open</a></li>
     <li><a href="#">Content 5 should open</a></li>
     <li><a href="#">Content 6 should open</a></li>
     <li><a href="#">Content 7 should open</a></li>
</ul>


<div class="head" onclick="return showDivs();">Head1</div>
<div class="content">Content 1 is here</div>
<div class="head">Head1</div>
<div class="content">Content 2 is here</div>
<div class="head">Head1</div>
<div class="content">Content 3 is here</div>
<div class="head">Head1</div>
<div class="content">Content 4 is here</div>
<div class="head">Head1</div>
<div class="content">Content 5 is here</div>
<div class="head">Head1</div>
<div class="content">Content 6 is here</div>
<div class="head">Head1</div>
<div class="content">Content 7 is here</div>

CSS

.head{background:#f00;cursor:pointer;}
.content{background:#ff6;}
.content{display:none;}

JavaScript

$(function() {
    $('ul li').each(function() {
        $(this).click(function(e){
            e.preventDefault();
            var i = $(this).index();
            $('.content').hide();
            $('.head:eq('+i+')').next().show();
        }); 
    });
});