- )
+ );
}
export async function getStaticProps() {
- const allPostsData = getSortedPostsData()
+ const allPostsData = getSortedPostsData();
return {
props: {
- allPostsData
- }
- }
+ allPostsData,
+ },
+ };
}
diff --git a/basics/api-routes-starter/pages/posts/[id].js b/basics/api-routes-starter/pages/posts/[id].js
index 28faaad5..efc338e8 100644
--- a/basics/api-routes-starter/pages/posts/[id].js
+++ b/basics/api-routes-starter/pages/posts/[id].js
@@ -1,8 +1,8 @@
-import Layout from '../../components/layout'
-import { getAllPostIds, getPostData } from '../../lib/posts'
-import Head from 'next/head'
-import Date from '../../components/date'
-import utilStyles from '../../styles/utils.module.css'
+import Layout from '../../components/layout';
+import { getAllPostIds, getPostData } from '../../lib/posts';
+import Head from 'next/head';
+import Date from '../../components/date';
+import utilStyles from '../../styles/utils.module.css';
export default function Post({ postData }) {
return (
@@ -18,22 +18,22 @@ export default function Post({ postData }) {
- )
+ );
}
export async function getStaticPaths() {
- const paths = getAllPostIds()
+ const paths = getAllPostIds();
return {
paths,
- fallback: false
- }
+ fallback: false,
+ };
}
export async function getStaticProps({ params }) {
- const postData = await getPostData(params.id)
+ const postData = await getPostData(params.id);
return {
props: {
- postData
- }
- }
+ postData,
+ },
+ };
}
diff --git a/basics/api-routes-starter/posts/pre-rendering.md b/basics/api-routes-starter/posts/pre-rendering.md
index de33130f..3bf0c3ee 100644
--- a/basics/api-routes-starter/posts/pre-rendering.md
+++ b/basics/api-routes-starter/posts/pre-rendering.md
@@ -1,6 +1,6 @@
---
-title: "Two Forms of Pre-rendering"
-date: "2020-01-01"
+title: 'Two Forms of Pre-rendering'
+date: '2022-01-01'
---
Next.js has two forms of pre-rendering: **Static Generation** and **Server-side Rendering**. The difference is in **when** it generates the HTML for a page.
@@ -8,4 +8,4 @@ Next.js has two forms of pre-rendering: **Static Generation** and **Server-side
- **Static Generation** is the pre-rendering method that generates the HTML at **build time**. The pre-rendered HTML is then _reused_ on each request.
- **Server-side Rendering** is the pre-rendering method that generates the HTML on **each request**.
-Importantly, Next.js lets you **choose** which pre-rendering form to use for each page. You can create a "hybrid" Next.js app by using Static Generation for most pages and using Server-side Rendering for others.
\ No newline at end of file
+Importantly, Next.js lets you **choose** which pre-rendering form to use for each page. You can create a "hybrid" Next.js app by using Static Generation for most pages and using Server-side Rendering for others.
diff --git a/basics/api-routes-starter/posts/ssg-ssr.md b/basics/api-routes-starter/posts/ssg-ssr.md
index fe4a156a..b670ac3e 100644
--- a/basics/api-routes-starter/posts/ssg-ssr.md
+++ b/basics/api-routes-starter/posts/ssg-ssr.md
@@ -1,6 +1,6 @@
---
-title: "When to Use Static Generation v.s. Server-side Rendering"
-date: "2020-01-02"
+title: 'When to Use Static Generation v.s. Server-side Rendering'
+date: '2022-01-02'
---
We recommend using **Static Generation** (with and without data) whenever possible because your page can be built once and served by CDN, which makes it much faster than having a server render the page on every request.
@@ -16,4 +16,4 @@ You should ask yourself: "Can I pre-render this page **ahead** of a user's reque
On the other hand, Static Generation is **not** a good idea if you cannot pre-render a page ahead of a user's request. Maybe your page shows frequently updated data, and the page content changes on every request.
-In that case, you can use **Server-Side Rendering**. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side JavaScript to populate data.
\ No newline at end of file
+In that case, you can use **Server-Side Rendering**. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side JavaScript to populate data.
diff --git a/basics/api-routes-starter/styles/global.css b/basics/api-routes-starter/styles/global.css
index 9e1b0fbc..c3509347 100644
--- a/basics/api-routes-starter/styles/global.css
+++ b/basics/api-routes-starter/styles/global.css
@@ -2,8 +2,18 @@ html,
body {
padding: 0;
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
- Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
+ font-family:
+ -apple-system,
+ BlinkMacSystemFont,
+ Segoe UI,
+ Roboto,
+ Oxygen,
+ Ubuntu,
+ Cantarell,
+ Fira Sans,
+ Droid Sans,
+ Helvetica Neue,
+ sans-serif;
line-height: 1.6;
font-size: 18px;
}
diff --git a/basics/assets-metadata-css-starter/.nvmrc b/basics/assets-metadata-css-starter/.nvmrc
new file mode 100644
index 00000000..3c032078
--- /dev/null
+++ b/basics/assets-metadata-css-starter/.nvmrc
@@ -0,0 +1 @@
+18
diff --git a/basics/assets-metadata-css-starter/README.md b/basics/assets-metadata-css-starter/README.md
index 02695bc1..1a60afbe 100644
--- a/basics/assets-metadata-css-starter/README.md
+++ b/basics/assets-metadata-css-starter/README.md
@@ -1 +1 @@
-This is a starter template for [Learn Next.js](https://nextjs.org/learn).
\ No newline at end of file
+This is a starter template for [Learn Next.js](https://nextjs.org/learn).
diff --git a/basics/assets-metadata-css-starter/package.json b/basics/assets-metadata-css-starter/package.json
index 9e4441a0..159e2344 100644
--- a/basics/assets-metadata-css-starter/package.json
+++ b/basics/assets-metadata-css-starter/package.json
@@ -1,13 +1,16 @@
{
"private": true,
"scripts": {
- "dev": "next dev",
"build": "next build",
+ "dev": "next dev --turbopack",
"start": "next start"
},
"dependencies": {
"next": "latest",
- "react": "17.0.2",
- "react-dom": "17.0.2"
+ "react": "latest",
+ "react-dom": "latest"
+ },
+ "engines": {
+ "node": ">=18"
}
}
diff --git a/basics/assets-metadata-css-starter/pages/index.js b/basics/assets-metadata-css-starter/pages/index.js
index a245ddc8..47efa0fe 100644
--- a/basics/assets-metadata-css-starter/pages/index.js
+++ b/basics/assets-metadata-css-starter/pages/index.js
@@ -1,41 +1,38 @@
-import Link from 'next/link'
-
-import Head from 'next/head'
+import Link from 'next/link';
+import Head from 'next/head';
+import styles from '../styles/Home.module.css';
export default function Home() {
return (
-