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
- blockchain
- REACT
- concept
- evm
- CSS
- hardhat
- CLASS
- JavaScript
- middleware
- nextJS
- error
- Props
- tailwindcss
- 삶
- web
- useState
- API
- graphQL
- bitcoin
- built in object
- node.js
- Interface
- typeScript
- Ethereum
- 기준
- express.js
- HTML
- SSR
- Redux
- solidity
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