Skip to content

Commit

Permalink
Simplified example
Browse files Browse the repository at this point in the history
  • Loading branch information
lfades committed Jan 22, 2020
1 parent a8ba270 commit 28eb405
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions examples/catch-all-routes/pages/post/[...slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import Header from '../../components/header'

const Comment = () => {
const router = useRouter()
const { slug = [] } = router.query
const [year, ...postSlug] = slug
const slug = router.query.slug || []

return (
<>
<Header />
<h1>Year: {year}</h1>
<h1>Slug: {postSlug.join('/')}</h1>
<h1>Slug: {slug.join('/')}</h1>
</>
)
}
Expand Down

0 comments on commit 28eb405

Please sign in to comment.