I have 2 pages Home page and About us page where the links for both end in /home and /about respectively. The landing page is my home page so I have set the css property for that to active so it highlights. But when I go to my about page the home page css stays active. How do I dynamically change the css when my route changes in nextJs?
My current Code:
export default function Nav({ children }) {
return (
<div>
<Head>
<title>Legacy</title>
<meta name="description" content="Generated by create next app" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
</Head>
<nav>
<div className="logo">Legacy</div>
<input type="checkbox" id="click" />
<label for="click" className="menu-btn">
<i className="fas fa-bars"></i>
</label>
<ul>
<li>
<Link href="http://localhost:3000/home">
<a className="active" >
Home
</a>
</Link>
</li>
<li>
<Link href="http://localhost:3000/about">
<a >About Us</a>
</Link>
</li>
</ul>
</nav>
</div>
);
}