JSFiddle - React, Tailwind, and code Playground

HTML

<div class="dropdown">
    <button class="dropbtn" id="dropdown">Dropdown
        <i class="fa fa-caret-down"></i>
    </button>
    <div class="dropdown-content" id="dropdown-content">
        <a href="#">Link 1</a>
        <a href="#">Link 2</a>
        <a href="#">Link 3</a>
    </div>
</div>
<div class="dropdown">
    <button class="dropbtn" id="dropdown-2">Dropdown
        <i class="fa fa-caret-down"></i>
    </button>
    <div class="dropdown-content" id="dropdown-content-2">
        <a href="#">Link 4</a>
        <a href="#">Link 5</a>
        <a href="#">Link 6</a>
    </div>
</div>

CSS

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-content a {
    float: none;
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: grey;
}

JavaScript

/**
 * ugly if-else click listener
 * @type {boolean}
 */

let activeDrop1 = false;
document.getElementById('dropdown').addEventListener('click', function() {
    if(activeDrop1) {
        document.getElementById('dropdown-content').style.display = 'none';
        activeDrop1 = false;
    } else {
        document.getElementById('dropdown-content').style.display = 'block';
        activeDrop1 = true;
    }
});

let activeDrop2 = false;
document.getElementById('dropdown-2').addEventListener('click', function() {
    if(activeDrop2) {
        document.getElementById('dropdown-content-2').style.display = 'none';
        activeDrop2 = false;
    } else {
        document.getElementById('dropdown-content-2').style.display = 'block';
        activeDrop2 = true;
    }
});