docs: update active link code snippet for better equality check (#53327)

Update pathname and href matching check from startsWith() method to strict equality. startsWith() method causes all paths to match with root link "/"
This commit is contained in:
Ozan Sevkin 2023-07-31 09:21:59 +10:00 committed by GitHub
parent d3b0c7bb42
commit 97a0a3373f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,7 @@ export function Navigation({ navLinks }) {
return (
<>
{navLinks.map((link) => {
const isActive = pathname.startsWith(link.href)
const isActive = pathname === link.href
return (
<Link