rsnext/examples/active-class-name/pages/[slug].js
Aubrey 7d8e0c512f
updated active-class-name example to also demo a [slug] path (#15924)
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
2020-08-06 01:26:48 +00:00

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