JSFiddle - React, Tailwind, and code Playground

HTML

<h1>Title (<a rel="collapsable[#testdiv]" href="#">Expand</a>)</h1>
<div id="testdiv">
    <p>Display the contents in here.</p>
</div>

CSS

#testdiv {
    display: none;
}

JavaScript

var $testdiv = $('#testdiv');

$('a').click(function( e ) {
    e.preventDefault();
    var $this = $(this),
        t = $this.text();
    $this.text( t === "Expand" ? "Collapse" : "Expand" );
    $testdiv.stop().slideToggle();
});