JSFiddle - React, Tailwind, and code Playground
JavaScript
const path = window.location.pathname.split('/')[0];
if(path.length) {
document.getElementById(`menu-#{path}`).classList.add('active');
} else {
document.getElementById(`menu-welcome`).classList.add('active');
}