250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- JavaScript
- graphQL
- 기준
- Props
- evm
- REACT
- hardhat
- nextJS
- bitcoin
- 삶
- concept
- CSS
- solidity
- express.js
- tailwindcss
- blockchain
- middleware
- API
- web
- SSR
- Redux
- node.js
- Ethereum
- error
- CLASS
- Interface
- typeScript
- HTML
- useState
- built in object
Archives
- Today
- Total
ReasonJun
Next.js : File System-based Routing (Dynamic Routing ) 본문
Frontend/Next.js
Next.js : File System-based Routing (Dynamic Routing )
ReasonJun 2023. 6. 18. 18:40728x90
Dynamic Routing
pages/product/first-item
pages/category/[slug].js => /category/:slug (ex. /category/food )
pages/[username]/info.js => /:username/info (ex. /youjun/info )
pages/cart/[...slug].js => /cart/* (ex. /cart/2022/06/24 )
useRouter / query
Multiple Slug
pages/[username]/[info].js
const { username, info } = router.query
pages/cart/[...slug].js
const { slug } = router.query
=> array
Optional Slug
pages/cart/[]...slug.js => Accessing '/cart' results in 404.
pages/cart/[[...slug]].js => It is received even if the slug does not exist. The default page is displayed.
728x90
'Frontend > Next.js' 카테고리의 다른 글
Next.js : API Routes (0) | 2023.06.18 |
---|---|
Next.js : File System-based Routing (Shallow Routing) (0) | 2023.06.18 |
Next.js : Apply common layout (0) | 2023.06.18 |
Next.js : Image component (0) | 2023.06.18 |
Next.js : getStaticProps with revalidata (ISR) (0) | 2023.06.18 |
Comments