JSFiddle - React, Tailwind, and code Playground

HTML

<p>
    <a href="#" id="1">Page 1</a> <a href="#" id="2">Page 2</a> <a href="#" id="3">Page 3</a>
</p>

<div>
    <div id="content1">
        This is page 1.
    </div>
    
    <div id="content2">
        This is page 2.
    </div>
    
    <div id="content3">
        This is page 3.
    </div>
</div>

JavaScript

$('#content2, #content3').hide();

$('a').click(function() {
    var id = $(this).attr('id');
    $('#content' + id).show().siblings().hide();
});