skip to Main Content

Css – Next.js conditional style

I want to make a link active if the pathname matches its href. function Component() { const pathname = usePathname(); return ( <div className="links"> <Link href="/">Home</Link> <Link href="/store" className={`${pathname === this.href && "active"}`} >Store</Link> <Link href="/actors">Actors</Link> </div> )} That's what…

VIEW QUESTION
Back To Top
Search