JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<h2>
<span class="h2toggle">Heading (This shows an hide the div below)</span>
</h2>
<div>
<p>Some text</p>
<p>More text</p>
</div>
</div>
<div>
<h2>
<span class="h2toggle">Heading 2 (This shows an hide the div below)</span>
</h2>
<div>
<p>Some text 2</p>
<p>More text 2</p>
</div>
</div>
JavaScript
$('.h2toggle').parent('h2').next('div').slideUp();
$('.h2toggle').click(function(){
var $span = $(this);
$span.parent('h2').next('div').slideToggle();
});