├── .gitignore
├── .prettierignore
├── .prettierrc
├── .vscode
└── extensions.json
├── README.md
├── exercises
├── exercise-01--create-a-new-next-js-type-script-project
│ └── README.md
├── exercise-02--create-and-navigate-between-pages
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-03--create-dynamic-routes
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-04--serve-static-assets
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── lazar.png
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-05--use-next-image-for-image-optimization
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── lazar.png
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-06--provide-page-specific-metadata
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-07--override-the-app-component
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-08--override-the-document
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-09--create-custom-style
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ ├── src
│ │ └── components
│ │ │ └── button
│ │ │ └── button.tsx
│ ├── styles
│ │ └── globals.css
│ └── tsconfig.json
├── exercise-10--create-custom-layouts
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ ├── src
│ │ └── components
│ │ │ └── layout
│ │ │ ├── footer.tsx
│ │ │ ├── index.tsx
│ │ │ └── navbar.tsx
│ └── tsconfig.json
├── exercise-11--use-ui-frameworks-like-chakra-ui
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ ├── _document.tsx
│ │ └── index.tsx
│ ├── theme.ts
│ └── tsconfig.json
├── exercise-12--use-the-static-generation-method
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-13--use-the-server-side-rendering-method
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-14--create-and-use-api-routes
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── data
│ │ └── users.ts
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── tsconfig.json
└── exercise-15--deploy-your-next-js-app-on-vercel
│ ├── README.md
│ └── readme-assets
│ ├── configure-project.png
│ ├── import-repository.png
│ └── repository-import.png
├── final
├── exercise-01--create-a-new-next-js-type-script-project
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ ├── api
│ │ │ └── hello.ts
│ │ └── index.tsx
│ ├── public
│ │ ├── favicon.ico
│ │ └── vercel.svg
│ ├── styles
│ │ ├── Home.module.css
│ │ └── globals.css
│ └── tsconfig.json
├── exercise-02--create-and-navigate-between-pages
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── about.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-03--create-dynamic-routes
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── [genre]
│ │ │ ├── [artist].tsx
│ │ │ └── index.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-04--serve-static-assets
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ ├── public
│ │ └── lazar.png
│ └── tsconfig.json
├── exercise-05--use-next-image-for-image-optimization
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── lazar.png
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-06--provide-page-specific-metadata
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-07--override-the-app-component
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-08--override-the-document
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _document.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-09--create-custom-style
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ ├── src
│ │ └── components
│ │ │ └── button
│ │ │ ├── button.module.css
│ │ │ └── button.tsx
│ ├── styles
│ │ └── globals.css
│ └── tsconfig.json
├── exercise-10--create-custom-layouts
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ ├── src
│ │ └── components
│ │ │ └── layout
│ │ │ ├── footer.tsx
│ │ │ ├── index.tsx
│ │ │ └── navbar.tsx
│ └── tsconfig.json
├── exercise-11--use-ui-frameworks-like-chakra-ui
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ ├── _document.tsx
│ │ └── index.tsx
│ ├── theme.ts
│ └── tsconfig.json
├── exercise-12--use-the-static-generation-method
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── [genre].tsx
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-13--use-the-server-side-rendering-method
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── [genre].tsx
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── tsconfig.json
├── exercise-14--create-and-use-api-routes
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── data
│ │ └── users.ts
│ ├── next-env.d.ts
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ ├── api
│ │ │ └── users
│ │ │ │ └── [userId].ts
│ │ └── index.tsx
│ └── tsconfig.json
└── exercise-15--deploy-your-next-js-app-on-vercel
│ ├── README.md
│ └── readme-assets
│ ├── configure-project.png
│ ├── import-repository.png
│ └── repository-import.png
├── github-share--nextjs-fundamental-api-patterns.png
├── package-lock.json
├── package.json
├── tsconfig.json
└── workshop-cover.png
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /**/node_modules
6 | /.pnp
7 | .pnp.js
8 |
9 | # testing
10 | /coverage
11 |
12 | # next.js
13 | /**/.next/
14 | /**/out/
15 |
16 | # production
17 | /build
18 |
19 | # misc
20 | **/.DS_Store
21 | *.pem
22 |
23 | # debug
24 | /**npm-debug.log*
25 | /**yarn-debug.log*
26 | /**yarn-error.log*
27 |
28 | # local env files
29 | /**.env.local
30 | /**.env.development.local
31 | /**.env.test.local
32 | /**.env.production.local
33 |
34 | # vercel
35 | .vercel
36 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | **/*.md
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": false,
3 | "trailingComma": "none",
4 | "singleQuote": true,
5 | "printWidth": 80
6 | }
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
3 | }
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The Beginner's Guide to Next.js
2 |
3 | [](https://egghead.io/courses/fundamental-next-js-api-and-patterns-a6a7509f)
4 |
5 | ## 👋 Welcome
6 |
7 | Welcome to The Beginner's Guide to Next.js [egghead.io](https://egghead.io) workshop! 🚀
8 |
9 | In this workshop we will discover the essential features of Next.js. Every exercise is an isolated mini project that focuses only on a specific feature, so you don't have anything extra to worry about. By the end of this workshop, you'll learn how to create Next.js projects, use Next.js's data fetching methods, create your own API handlers, use UI frameworks, and deploy your apps on Vercel.
10 |
11 | I hope you like this workshop, and have fun learning ❤️
12 |
13 | ## 🤠 Instructor
14 |
15 | My name is Lazar Nikolov and I'm a full stack developer from North Macedonia 🇲🇰, based in Canada 🇨🇦!
16 |
17 | My first interaction with programming was back in 2011, while I was still in high school. I was learning HTML and CSS on my own, sometimes during the classes (don't tell my teachers 🤫). Throughout my career I've been developing mobile apps, TV apps, desktop apps, but I've found my sweet spot as a Full-stack Engineer working with the React ecosystem.
18 |
19 | I'm a super friendly guy, so if you have any questions, or just want to talk to me, the best place to reach me is on Twitter at [@NikolovLazar](https://twitter.com/NikolovLazar).
20 |
21 | ## 🎯 Goal
22 |
23 | After finishing this workshop, you'll become comfortable using Next.js to build your web apps and deploy them on Vercel.
24 |
25 | ## 🚅 Skills
26 |
27 | You'll learn about web page rendering like SSR, SSG, which as a skill is completely transferrable in other frameworks and technologies.
28 |
29 | If you haven't worked with TypeScript before, that's another skill that you'll learn and also apply in other frameworks and technologies.
30 |
31 | We'll also going learn how to architecture our front-end using pages, layouts, and components, which is a skill you can apply in every front-end project in your future.
32 |
33 | ## 🚧 Prerequisites
34 |
35 | Before starting this workshop, you should be comfortable working with React, TypeScript, and understand basic Web Dev concepts.
36 |
37 | Here are some egghead.io courses that can bring you up to speed:
38 | - [The Beginner's Guide to React](https://egghead.io/courses/the-beginner-s-guide-to-react) by Kent C. Dodds
39 | - [React Context for State Management](https://egghead.io/courses/react-context-for-state-management) by Dave Ceddia
40 | - [Shareable Custom Hooks in React](https://egghead.io/courses/shareable-custom-hooks-in-react) by Joe Previte
41 | - [Up and Running with TypeScript](https://egghead.io/courses/up-and-running-with-typescript) by John Lindquist
42 | - [Use Types Effectively in TypeScript](https://egghead.io/courses/use-types-effectively-in-typescript) by Ari Picker
43 |
44 | ## 💽 Workshop Setup
45 |
46 | Make sure you have [Node.js](https://nodejs.org/), [Visual Studio Code](https://code.visualstudio.com/) installed on your machine.
47 |
48 | Each exercise is its own Next.js project and lives inside the `/exercises` folder. To get started, run `npm install` at the root (this installs all of the dependencies), `cd` into `exercises` and open the execise's README file (`exercises/exercise-01--create-a-new-next-js-type-script-project/README.md`), which contains the instructions. Each exercise can be run by running `npm run dev` at the root of the exercise.
49 |
50 | ## 🔢 Exercises list
51 |
52 | - `Exercise 01` - [Create a new Next.js TypeScript project](exercises/exercise-01--create-a-new-next-js-type-script-project)
53 | - `Exercise 02` - [Create and navigate between pages](exercises/exercise-02--create-and-navigate-between-pages)
54 | - `Exercise 03` - [Create Dynamic Routes](exercises/exercise-03--create-dynamic-routes)
55 | - `Exercise 04` - [Serve static assets](exercises/exercise-04--serve-static-assets)
56 | - `Exercise 05` - [Use `next/image` for Image Optimization](exercises/exercise-05--use-next-image-for-image-optimization)
57 | - `Exercise 06` - [Provide page-specific metadata](exercises/exercise-06--provide-page-specific-metadata)
58 | - `Exercise 07` - [Override the App component](exercises/exercise-07--override-the-app-component)
59 | - `Exercise 08` - [Override the Document](exercises/exercise-08--override-the-document)
60 | - `Exercise 09` - [Create custom style](exercises/exercise-09--create-custom-style)
61 | - `Exercise 10` - [Create custom Layouts](exercises/exercise-10--create-custom-layouts)
62 | - `Exercise 11` - [Use UI frameworks like Chakra UI](exercises/exercise-11--use-ui-frameworks-like-chakra-ui)
63 | - `Exercise 12` - [Use the Static Generation method](exercises/exercise-12--use-the-static-generation-method)
64 | - `Exercise 13` - [Use the Server-side Rendering method](exercises/exercise-13--use-the-server-side-rendering-method)
65 | - `Exercise 14` - [Create and use API Routes](exercises/exercise-14--create-and-use-api-routes)
66 | - `Exercise 15` - [Deploy your Next.js app on Vercel](exercises/exercise-15--deploy-your-next-js-app-on-vercel)
67 |
68 | ## ❤️ Contributors
69 |
70 | PRs are always welcome. If you find a typo, or have any ideas on how to improve the content, feel free to submit a PR. Let's make learning Next.js better for everyone!
71 |
72 | ## 🍩 Feedback form
73 |
74 | Your feedback is always welcome 🙏. It's not just useful for me. Your feedback will help me make the content better for every other developer friend in future. Visit [this form](https://forms.gle/fXJdRAT5SBSjGspb7) if you feel like providing a feedback.
75 |
76 | Thank you ❤️
77 |
--------------------------------------------------------------------------------
/exercises/exercise-01--create-a-new-next-js-type-script-project/README.md:
--------------------------------------------------------------------------------
1 | # Exercise 01: Create a new Next.js TypeScript project
2 |
3 | ## What is Next.js?
4 |
5 | Next.js is an open-source React framework built on top of Node.js. It enables developers to build super fast, optimized web sites and web apps. While traditional React apps are rendered on the client-side, Next.js gives you the option to also render your pages on the server-side. Its features like built-in router, per-page rendering options, and automatic static optimization, provide a best in class developer experience and rapid feature development. The React documentation lists Next.js as a "Recommended Toolchain" for building a server-side rendered React apps. It is originally built by Guillermo Rauch, and it is developed and maintained by Vercel.
6 |
7 | ## Background
8 |
9 | NPM has a tool called `npx` used for executing NPM Package Binaries. You can install it by running `npm install -g npx` in your terminal. We can use the `npx` tool to execute packages like `create-react-app` and `create-next-app` that will scaffold our new project.
10 |
11 | ## 🚀 Exercise
12 |
13 | Create an empty Next.js TypeScript project using the [create-next-app](https://www.npmjs.com/package/create-next-app) npx template. Because we want to use TypeScript, we need to provide an additional argument in the CLI command to tell `create-next-app` to create our project with TypeScript.
14 |
15 | ## 🍩 Exercise Feedback form
16 |
17 | Writing down what you learn is key to your retention. Also, I want to make sure each exercise is effective at helping you learn the material. Please quickly fill out [this form](https://docs.google.com/forms/d/e/1FAIpQLSeKPJV5UInaNFlZawN7vZdNyPngyinrkp7eoQO0vzwGzh2EtQ/viewform?usp=pp_url&entry.651170566=Exercise+01+-+Create+a+new+Next.js+TypeScript+project) so you can elaborate on what you learned and give me feedback so I can improve it for future learners.
--------------------------------------------------------------------------------
/exercises/exercise-02--create-and-navigate-between-pages/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/exercises/exercise-02--create-and-navigate-between-pages/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
36 | # typescript
37 | *.tsbuildinfo
38 |
--------------------------------------------------------------------------------
/exercises/exercise-02--create-and-navigate-between-pages/README.md:
--------------------------------------------------------------------------------
1 | # Exercise 02: Create and navigate between pages
2 |
3 | ## Background
4 |
5 | In Next.js, every page is a React component that lives in the `pages/` directory. Every other React component that lives outside of the `pages/` directory is not being considered as a page. Next.js's built-in router generates our routes automatically based on our project structure. For example:
6 |
7 | - The index `/` page would be the `pages/index.tsx` file,
8 | - The `/about` page would be `pages/about.tsx` file,
9 | - The `docs/getting-started` page would be `pages/docs/getting-started.tsx` file, and so on.
10 |
11 | To navigate between pages, Next.js provides us a `Link` component that's exported from the `next/link` package. To create a link to our About page, we can do the following:
12 |
13 | ```typescript
14 | import Link from 'next/link'
15 |
16 | const Home = () => {
17 | return (
18 | About
19 | )
20 | }
21 |
22 | export default Home;
23 | ```
24 |
25 | ## 🚀 Exercise
26 |
27 | Create a new "About" page and add a link in the Home page to it.
28 |
29 | ## 🍩 Exercise Feedback form
30 |
31 | Writing down what you learn is key to your retention. Also, I want to make sure each exercise is effective at helping you learn the material. Please quickly fill out [this form](https://docs.google.com/forms/d/e/1FAIpQLSeKPJV5UInaNFlZawN7vZdNyPngyinrkp7eoQO0vzwGzh2EtQ/viewform?usp=pp_url&entry.651170566=Exercise+02+-+Create+and+navigate+between+pages) so you can elaborate on what you learned and give me feedback so I can improve it for future learners.
--------------------------------------------------------------------------------
/exercises/exercise-02--create-and-navigate-between-pages/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
Post: {pid}
17 | } 18 | 19 | export default Post 20 | ``` 21 | 22 | Any route like `/post/1`, `/post/hello-world`, etc. will be matched by the `[pid].tsx` page. The dynamic parameter `pid` will be available to us as a query parameter through Next.js's router. 23 | 24 | If we want to have a multi-segment dynamic route, we can wrap the folders' names with brackets too, for example `pages/post/[pid]/[comment].tsx`. The router's query will merge the two dynamic segments, so if we visited `/post/hello-world/love-it`, the `query` object will be: 25 | ```typescript 26 | { pid: "hello-world", comment: "love-it" } 27 | ``` 28 | 29 | ## 🚀 Exercise 30 | 31 | Create a genre page that will display the genre's name dynamically. Examples: 32 | - `/rock` 33 | - `/country` 34 | - `/pop` 35 | 36 | ## ⭐️ Challenge 37 | 38 | Make a new dynamic page that will display the artist's name and their music genre. Examples: 39 | - `/rock/axl-rose` should display "axl-rose is a rock music artist!" 40 | - `/country/chris-stapleton` should display "chris-stapleton is a country music artist!" 41 | - `/pop/bruno-mars` should display "bruno-mars is a pop music artist!" 42 | 43 | ## 🚩 Checkpoint 44 | This exercise marks the first checkpoint at which we'll go into breakout rooms to do the following exercises: 45 | - [Exercise 01: Create a new Next.js TypeScript project](../exercise-01--create-a-new-next-js-type-script-project) 46 | - [Exercise 02: Create and navigate between pages](../exercise-02--create-and-navigate-between-pages) 47 | - [Exercise 03: Create Dynamic Routes](../exercise-03--create-dynamic-routes) 48 | 49 | Start with the first exercise, and work your way through the last one. If you're stuck, do not hesitate to ask. As soon as you're done you can fill out either the [Post-Breakout Feedback Form](https://docs.google.com/forms/d/e/1FAIpQLSda0BFV57OWbSkshNC_jZ809HEBOuW_MzLEz1Bq4PVKtI7R9w/viewform?usp=pp_url&entry.651170566=Group+1:+New+Project,+Pages+%26+Navigation,+Dynamic+Routes), or the feedback forms for each individual exercise. I would appreciate your feedback a lot. 50 | 51 | ## 🍩 Exercise Feedback form 52 | 53 | Writing down what you learn is key to your retention. Also, I want to make sure each exercise is effective at helping you learn the material. Please quickly fill out [this form](https://docs.google.com/forms/d/e/1FAIpQLSeKPJV5UInaNFlZawN7vZdNyPngyinrkp7eoQO0vzwGzh2EtQ/viewform?usp=pp_url&entry.651170566=Exercise+03+-+Create+Dynamic+Routes) so you can elaborate on what you learned and give me feedback so I can improve it for future learners. -------------------------------------------------------------------------------- /exercises/exercise-03--create-dynamic-routes/next-env.d.ts: -------------------------------------------------------------------------------- 1 | ///My name is Lazar Nikolov
6 | {/* ✍️ add the "lazar.png" image here */} 7 |Nothing to see here
6 |
21 | Get started by editing{' '}
22 | pages/index.tsx
23 |
Find in-depth information about Next.js features and API.
29 | 30 | 31 | 32 |Learn about Next.js in an interactive course with quizzes!
34 | 35 | 36 | 40 |Discover and deploy boilerplate example Next.js projects.
42 | 43 | 44 | 48 |50 | Instantly deploy your Next.js site to a public URL with Vercel. 51 |
52 | 53 |Post: {pid}
17 | } 18 | 19 | export default Post 20 | ``` 21 | 22 | Any route like `/post/1`, `/post/hello-world`, etc. will be matched by the `[pid].tsx` page. The dynamic parameter `pid` will be available to us as a query parameter through Next.js's router. 23 | 24 | If we want to have a multi-segment dynamic route, we can wrap the folders' names with brackets too, for example `pages/post/[pid]/[comment].tsx`. The router's query will merge the two dynamic segments, so if we visited `/post/hello-world/love-it`, the `query` object will be: 25 | ```typescript 26 | { pid: "hello-world", comment: "love-it" } 27 | ``` 28 | 29 | ## 🚀 Exercise 30 | 31 | Create a genre page that will display the genre's name dynamically. Examples: 32 | - `/rock` 33 | - `/country` 34 | - `/pop` 35 | 36 | ## ⭐️ Challenge 37 | 38 | Make a new dynamic page that will display the artist's name and their music genre. Examples: 39 | - `/rock/axl-rose` should display "axl-rose is a rock music artist!" 40 | - `/country/chris-stapleton` should display "chris-stapleton is a country music artist!" 41 | - `/pop/bruno-mars` should display "bruno-mars is a pop music artist!" 42 | 43 | ## 🚩 Checkpoint 44 | This exercise marks the first checkpoint at which we'll go into breakout rooms to do the following exercises: 45 | - [Exercise 01: Create a new Next.js TypeScript project](../exercise-01--create-a-new-next-js-type-script-project) 46 | - [Exercise 02: Create and navigate between pages](../exercise-02--create-and-navigate-between-pages) 47 | - [Exercise 03: Create Dynamic Routes](../exercise-03--create-dynamic-routes) 48 | 49 | Start with the first exercise, and work your way through the last one. If you're stuck, do not hesitate to ask. As soon as you're done you can fill out either the [Post-Breakout Feedback Form](https://docs.google.com/forms/d/e/1FAIpQLSda0BFV57OWbSkshNC_jZ809HEBOuW_MzLEz1Bq4PVKtI7R9w/viewform?usp=pp_url&entry.651170566=Group+1:+New+Project,+Pages+%26+Navigation,+Dynamic+Routes), or the feedback forms for each individual exercise. I would appreciate your feedback a lot. 50 | 51 | ## 🍩 Exercise Feedback form 52 | 53 | Writing down what you learn is key to your retention. Also, I want to make sure each exercise is effective at helping you learn the material. Please quickly fill out [this form](https://docs.google.com/forms/d/e/1FAIpQLSeKPJV5UInaNFlZawN7vZdNyPngyinrkp7eoQO0vzwGzh2EtQ/viewform?usp=pp_url&entry.651170566=Exercise+03+-+Create+Dynamic+Routes) so you can elaborate on what you learned and give me feedback so I can improve it for future learners. -------------------------------------------------------------------------------- /final/exercise-03--create-dynamic-routes/next-env.d.ts: -------------------------------------------------------------------------------- 1 | ///My name is Lazar Nikolov
6 |Title: {title}
10 |Nothing to see here
6 |