7d8e0c512f
updated example for [active-class-name](f00ad581a1/examples/active-class-name
) to also support a `[slug].js` page that matches on `as` instead of `href` (as `href` would be `/[slug]`)
> This does not demo `[..slug].js` as this requires possible custom code for determining the slug path part for the active classname. i.e. page tree active nodes. A possible other example or another PR on this example.
Has possible information for:
* https://github.com/vercel/next.js/issues/7410
14 lines
248 B
JavaScript
14 lines
248 B
JavaScript
import { useRouter } from 'next/router'
|
|
import Nav from '../components/Nav'
|
|
|
|
const SlugPage = () => {
|
|
const { asPath } = useRouter()
|
|
return (
|
|
<>
|
|
<Nav />
|
|
<p>Hello, I'm the {asPath} page</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default SlugPage
|