JSFiddle - React, Tailwind, and code Playground

HTML

<div class="main">
    <div id="first">
        
    </div>
    
    <div id="second">
    </div>
    
    <div id="third">
    </div>
</div>

CSS

#first {
    width: 50px;
    height: 50px;
    background-color: blue;
    
}

#second {
    width: 50px;
    height: 50px;
    background-color: red;
}

#third {
    width: 50px;
    height: 50px;
    background-color: green;
    display: none;
}

JavaScript

$(document).ready(function() {
    $('#first, #second').click(function(){
        $('#third').fadeIn();
        $('#first, #second').fadeOut();
    });
    
    $('#third').click(function(){
        $('#third').fadeOut();
        $('#first, #second').fadeIn();
    });
});