Unverified Commit 904908cf authored by Hung Doan's avatar Hung Doan Committed by GitHub

docs(pages): update slug value for optional catch all routes (#64381)

## Why?

When you do, →

```
  const router = useRouter()
  console.log('[test] router =', router.query.slug)
 ```
 
 the value of `router.query.slug` should be undefined in this instance.
 
 (screenshot from current docs)
![CleanShot 2024-04-13 at 00 18 14@2x](https://github.com/vercel/next.js/assets/28912696/6cd79b3e-9258-4fcb-8685-dc6fe4d336e8)

it should be `slug: undefined`.
parent 68f722ba
......@@ -58,7 +58,7 @@ The difference between **catch-all** and **optional catch-all** segments is that
| Route | Example URL | `params` |
| --------------------------- | ------------- | --------------------------- |
| `pages/shop/[[...slug]].js` | `/shop` | `{ slug: [] }` |
| `pages/shop/[[...slug]].js` | `/shop` | `{ slug: undefined }` |
| `pages/shop/[[...slug]].js` | `/shop/a` | `{ slug: ['a'] }` |
| `pages/shop/[[...slug]].js` | `/shop/a/b` | `{ slug: ['a', 'b'] }` |
| `pages/shop/[[...slug]].js` | `/shop/a/b/c` | `{ slug: ['a', 'b', 'c'] }` |
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