Unverified Commit b280c82a authored by Henrik Wenz's avatar Henrik Wenz Committed by GitHub

[Examples] Fix active-class-name (#12931)

parent f840e1fe
...@@ -4,12 +4,12 @@ import Link from 'next/link' ...@@ -4,12 +4,12 @@ import Link from 'next/link'
import React, { Children } from 'react' import React, { Children } from 'react'
const ActiveLink = ({ children, activeClassName, ...props }) => { const ActiveLink = ({ children, activeClassName, ...props }) => {
const { pathname } = useRouter() const { asPath } = useRouter()
const child = Children.only(children) const child = Children.only(children)
const childClassName = child.props.className || '' const childClassName = child.props.className || ''
const className = const className =
pathname === props.href asPath === props.href
? `${childClassName} ${activeClassName}`.trim() ? `${childClassName} ${activeClassName}`.trim()
: childClassName : childClassName
......
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