So I have a very simple navbar that contains 5 links:
<div className='links' id={showLinks? "hidden": ""}>
<a class="btn" href="/">Dashboard</a>
<a class="btn" href="/tenants">Tenants</a>
<a class="btn" href="/stores">Stores</a>
<a class="btn" href="/pos">POS</a>
<a class="btn" href="/Invoices">Invoices</a>
</div>
It works however, I want to style the links based on which page I am on. For example, when I click on Stores, I want the Stores link in the navbar to be highlighted like in this image: Active Stores I know how to do the CSS to achieve this result, I just need to change the class name dynamically according to the link. I tried using useLocation in the Navbar but it only gets the location once, and not with each reload. If that makes sense.