JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <fieldset class="majorpoints" >
    <legend class="majorpointslegend">Expand</legend>
    <div id="mylist" style="display:none" >
        <ul>
            <li>2</li>
            <li>3</li>
        </ul>
    </div>
    </fieldset>
</div>

JavaScript

$('.majorpointslegend').click(function(){
    
    if($(this).text()=='Expand'){
        $('#mylist').show();
        $(this).text('Colapse');
    }else{
        $('#mylist').hide();
        $(this).text('Expand');
    }
   
});