JSFiddle - React, Tailwind, and code Playground

HTML

<span id="master">Click to toggle</span>

<div id="slave">Toggle this content</div>

CSS

#slave {display: none}

JavaScript

$('#master').click(function() {
    $('#slave').toggle();
});

$(document).not('#master','#slave').click(function() {
    $('#slave').hide();
});