Unverified Commit 737c25ed authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

doc: fix ActiveLink detection condition (#23472)



## Documentation / Examples

- [x] Make sure the linting passes


`router.pathname` can be dynamic routes like `/posts/[slug]`, use `router.asPath` instead to detect anchor is active
parent 9973b8cb
......@@ -17,7 +17,7 @@ function ActiveLink({ children, href }) {
const router = useRouter()
const style = {
marginRight: 10,
color: router.pathname === href ? 'red' : 'black',
color: router.asPath === href ? 'red' : 'black',
}
const handleClick = (e) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment