JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" id="clickme">Click Me</a>
<div id="extra">More text</div>

CSS

#clickme {
    background-color: red;
}
#extra {
    display: none;
    width: 100px;
    background-color: blue;
}

JavaScript

$("#clickme").click(function (e) {
    e.stopPropagation();
    $("#extra").fadeToggle();
});

$(document).click(function (e) {
    if (!$(e.target).closest('#extra').length)
    {
        $('#extra').fadeOut();
    }
});