diff --git a/api-routes-starter/components/Layout.js b/api-routes-starter/components/Layout.js index 23d70dc..661004e 100644 --- a/api-routes-starter/components/Layout.js +++ b/api-routes-starter/components/Layout.js @@ -6,59 +6,59 @@ import Link from 'next/link' const name = '[Your Name]' export const siteTitle = 'Next.js Sample Website' -const Page = ({ children, home }) => ( -
- - - - - -
- {home ? ( - <> - {name} -

{name}

- - ) : ( - <> - - - {name} - - -

+export default function Page({ children, home }) { + return ( +
+ + + + + +
+ {home ? ( + <> + {name} +

{name}

+ + ) : ( + <> - {name} + + {name} + -

- +

+ + {name} + +

+ + )} +
+
{children}
+ {!home && ( +
+ + ← Back to home + +
)} - -
{children}
- {!home && ( -
- - ← Back to home - -
- )} -
-) - -export default Page + + ) +} diff --git a/api-routes-starter/pages/_app.js b/api-routes-starter/pages/_app.js index 4fd261f..7e66efc 100644 --- a/api-routes-starter/pages/_app.js +++ b/api-routes-starter/pages/_app.js @@ -1,5 +1,5 @@ import '../styles/global.css' -const App = ({ Component, pageProps }) => - -export default App +export default function App({ Component, pageProps }) { + return +} diff --git a/api-routes-starter/pages/index.js b/api-routes-starter/pages/index.js index 6a9b7ab..a71aeb6 100644 --- a/api-routes-starter/pages/index.js +++ b/api-routes-starter/pages/index.js @@ -5,36 +5,38 @@ import { getSortedPostsData } from '../lib/posts' import Link from 'next/link' import Date from '../components/Date' -const Home = ({ allPostsData }) => ( - - - {siteTitle} - -
-

[Your Self Introduction]

-

- (This is a sample website - you’ll be building a site like this on{' '} - our Next.js tutorial.) -

-
-
-

Blog

-
    - {allPostsData.map(({ id, date, title }) => ( -
  • - - {title} - -
    - - - -
  • - ))} -
-
-
-) +export default function Home({ allPostsData }) { + return ( + + + {siteTitle} + +
+

[Your Self Introduction]

+

+ (This is a sample website - you’ll be building a site like this on{' '} + our Next.js tutorial.) +

+
+
+

Blog

+
    + {allPostsData.map(({ id, date, title }) => ( +
  • + + {title} + +
    + + + +
  • + ))} +
+
+
+ ) +} export async function getStaticProps() { const allPostsData = getSortedPostsData() diff --git a/api-routes-starter/pages/posts/[id].js b/api-routes-starter/pages/posts/[id].js index cafc88f..8dfa98b 100644 --- a/api-routes-starter/pages/posts/[id].js +++ b/api-routes-starter/pages/posts/[id].js @@ -4,20 +4,22 @@ import Head from 'next/head' import Date from '../../components/Date' import utilStyles from '../../styles/utils.module.css' -const Post = ({ postData }) => ( - - - {postData.title} - -
-

{postData.title}

-
- -
-
-
-
-) +export default function Post({ postData }) { + return ( + + + {postData.title} + +
+

{postData.title}

+
+ +
+
+
+
+ ) +} export async function getStaticPaths() { const paths = getAllPostIds() diff --git a/assets-metadata-css-starter/pages/posts/first-post.js b/assets-metadata-css-starter/pages/posts/first-post.js index 298ee4a..7f840e5 100644 --- a/assets-metadata-css-starter/pages/posts/first-post.js +++ b/assets-metadata-css-starter/pages/posts/first-post.js @@ -1,14 +1,14 @@ import Link from 'next/link' -const FirstPost = () => ( - <> -

First Post

-

- - Back to home - -

- -) - -export default FirstPost +export default function FirstPost() { + return ( + <> +

First Post

+

+ + Back to home + +

+ + ) +} diff --git a/basics-final/components/Layout.js b/basics-final/components/Layout.js index ab023c3..05d2860 100644 --- a/basics-final/components/Layout.js +++ b/basics-final/components/Layout.js @@ -6,59 +6,59 @@ import Link from 'next/link' const name = 'Shu Uesugi' export const siteTitle = 'Next.js Sample Website' -const Page = ({ children, home }) => ( -
- - - - - -
- {home ? ( - <> - {name} -

{name}

- - ) : ( - <> - - - {name} - - -

+export default function Page({ children, home }) { + return ( +
+ + + + + +
+ {home ? ( + <> + {name} +

{name}

+ + ) : ( + <> - {name} + + {name} + -

- +

+ + {name} + +

+ + )} +
+
{children}
+ {!home && ( +
+ + ← Back to home + +
)} - -
{children}
- {!home && ( -
- - ← Back to home - -
- )} -
-) - -export default Page + + ) +} diff --git a/basics-final/pages/_app.js b/basics-final/pages/_app.js index 4fd261f..7e66efc 100644 --- a/basics-final/pages/_app.js +++ b/basics-final/pages/_app.js @@ -1,5 +1,5 @@ import '../styles/global.css' -const App = ({ Component, pageProps }) => - -export default App +export default function App({ Component, pageProps }) { + return +} diff --git a/basics-final/pages/index.js b/basics-final/pages/index.js index db94ca6..caad2ae 100644 --- a/basics-final/pages/index.js +++ b/basics-final/pages/index.js @@ -5,42 +5,44 @@ import { getSortedPostsData } from '../lib/posts' import Link from 'next/link' import Date from '../components/Date' -const Home = ({ allPostsData }) => ( - - - {siteTitle} - -
-

- Hello, I’m Shu. I write code at{' '} - ZEIT, the team behind{' '} - Next.js. You can contact me via{' '} - Twitter or{' '} - email. -

-

- (This is a sample website - you’ll be building a site like this on{' '} - our Next.js tutorial.) -

-
-
-

Blog

-
    - {allPostsData.map(({ id, date, title }) => ( -
  • - - {title} - -
    - - - -
  • - ))} -
-
-
-) +export default function Home({ allPostsData }) { + return ( + + + {siteTitle} + +
+

+ Hello, I’m Shu. I write code at{' '} + ZEIT, the team behind{' '} + Next.js. You can contact me via{' '} + Twitter or{' '} + email. +

+

+ (This is a sample website - you’ll be building a site like this on{' '} + our Next.js tutorial.) +

+
+
+

Blog

+
    + {allPostsData.map(({ id, date, title }) => ( +
  • + + {title} + +
    + + + +
  • + ))} +
+
+
+ ) +} export async function getStaticProps() { const allPostsData = getSortedPostsData() @@ -50,5 +52,3 @@ export async function getStaticProps() { } } } - -export default Home diff --git a/basics-final/pages/posts/[id].js b/basics-final/pages/posts/[id].js index cafc88f..b45c6b4 100644 --- a/basics-final/pages/posts/[id].js +++ b/basics-final/pages/posts/[id].js @@ -4,20 +4,22 @@ import Head from 'next/head' import Date from '../../components/Date' import utilStyles from '../../styles/utils.module.css' -const Post = ({ postData }) => ( - - - {postData.title} - -
-

{postData.title}

-
- -
-
-
-
-) +export default function Post({ postData }) { + return ( + + + {postData.title} + +
+

{postData.title}

+
+ +
+
+
+
+ ) +} export async function getStaticPaths() { const paths = getAllPostIds() @@ -35,5 +37,3 @@ export async function getStaticProps({ params }) { } } } - -export default Post diff --git a/data-fetching-starter/components/Layout.js b/data-fetching-starter/components/Layout.js index 23d70dc..661004e 100644 --- a/data-fetching-starter/components/Layout.js +++ b/data-fetching-starter/components/Layout.js @@ -6,59 +6,59 @@ import Link from 'next/link' const name = '[Your Name]' export const siteTitle = 'Next.js Sample Website' -const Page = ({ children, home }) => ( -
- - - - - -
- {home ? ( - <> - {name} -

{name}

- - ) : ( - <> - - - {name} - - -

+export default function Page({ children, home }) { + return ( +
+ + + + + +
+ {home ? ( + <> + {name} +

{name}

+ + ) : ( + <> - {name} + + {name} + -

- +

+ + {name} + +

+ + )} +
+
{children}
+ {!home && ( + )} - -
{children}
- {!home && ( - - )} -
-) - -export default Page + + ) +} diff --git a/data-fetching-starter/pages/_app.js b/data-fetching-starter/pages/_app.js index 4fd261f..a508286 100644 --- a/data-fetching-starter/pages/_app.js +++ b/data-fetching-starter/pages/_app.js @@ -1,5 +1,7 @@ import '../styles/global.css' -const App = ({ Component, pageProps }) => +export default function App({ Component, pageProps }) { + return +} export default App diff --git a/data-fetching-starter/pages/index.js b/data-fetching-starter/pages/index.js index b07be0b..dad8d3d 100644 --- a/data-fetching-starter/pages/index.js +++ b/data-fetching-starter/pages/index.js @@ -2,19 +2,19 @@ import Head from 'next/head' import Layout, { siteTitle } from '../components/Layout' import utilStyles from '../styles/utils.module.css' -const Home = () => ( - - - {siteTitle} - -
-

[Your Self Introduction]

-

- (This is a sample website - you’ll be building a site like this on{' '} - our Next.js tutorial.) -

-
-
-) - -export default Home +export default function Home() { + return ( + + + {siteTitle} + +
+

[Your Self Introduction]

+

+ (This is a sample website - you’ll be building a site like this on{' '} + our Next.js tutorial.) +

+
+
+ ) +} diff --git a/data-fetching-starter/pages/posts/first-post.js b/data-fetching-starter/pages/posts/first-post.js index 3449b34..d9f319e 100644 --- a/data-fetching-starter/pages/posts/first-post.js +++ b/data-fetching-starter/pages/posts/first-post.js @@ -2,18 +2,18 @@ import Head from 'next/head' import Link from 'next/link' import Layout from '../../components/Layout' -const FirstPost = () => ( - - - First Post - -

First Post

-

- - Back to home - -

-
-) - -export default FirstPost +export default function FirstPost() { + return ( + + + First Post + +

First Post

+

+ + Back to home + +

+
+ ) +} diff --git a/dynamic-routes-starter/components/Layout.js b/dynamic-routes-starter/components/Layout.js index 23d70dc..661004e 100644 --- a/dynamic-routes-starter/components/Layout.js +++ b/dynamic-routes-starter/components/Layout.js @@ -6,59 +6,59 @@ import Link from 'next/link' const name = '[Your Name]' export const siteTitle = 'Next.js Sample Website' -const Page = ({ children, home }) => ( -
- - - - - -
- {home ? ( - <> - {name} -

{name}

- - ) : ( - <> - - - {name} - - -

+export default function Page({ children, home }) { + return ( +
+ + + + + +
+ {home ? ( + <> + {name} +

{name}

+ + ) : ( + <> - {name} + + {name} + -

- +

+ + {name} + +

+ + )} +
+
{children}
+ {!home && ( + )} - -
{children}
- {!home && ( - - )} -
-) - -export default Page + + ) +} diff --git a/dynamic-routes-starter/pages/_app.js b/dynamic-routes-starter/pages/_app.js index 4fd261f..a508286 100644 --- a/dynamic-routes-starter/pages/_app.js +++ b/dynamic-routes-starter/pages/_app.js @@ -1,5 +1,7 @@ import '../styles/global.css' -const App = ({ Component, pageProps }) => +export default function App({ Component, pageProps }) { + return +} export default App diff --git a/dynamic-routes-starter/pages/index.js b/dynamic-routes-starter/pages/index.js index 3ba085f..e437161 100644 --- a/dynamic-routes-starter/pages/index.js +++ b/dynamic-routes-starter/pages/index.js @@ -3,38 +3,38 @@ import Layout, { siteTitle } from '../components/Layout' import utilStyles from '../styles/utils.module.css' import { getSortedPostsData } from '../lib/posts' -const Home = ({ allPostsData }) => ( - - - {siteTitle} - -
-

[Your Self Introduction]

-
-
-

Blog

-
    - {allPostsData.map(({ id, date, title }) => ( -
  • - {title} -
    - {id} -
    - {date} -
  • - ))} -
-
-
-) +export default function Home({ allPostsData }) { + return ( + + + {siteTitle} + +
+

[Your Self Introduction]

+
+
+

Blog

+
    + {allPostsData.map(({ id, date, title }) => ( +
  • + {title} +
    + {id} +
    + {date} +
  • + ))} +
+
+
+ ) +} export async function getStaticProps() { const allPostsData = getSortedPostsData() return { props: { - allPostsData, - }, + allPostsData + } } } - -export default Home diff --git a/dynamic-routes-starter/pages/posts/first-post.js b/dynamic-routes-starter/pages/posts/first-post.js index 3449b34..d9f319e 100644 --- a/dynamic-routes-starter/pages/posts/first-post.js +++ b/dynamic-routes-starter/pages/posts/first-post.js @@ -2,18 +2,18 @@ import Head from 'next/head' import Link from 'next/link' import Layout from '../../components/Layout' -const FirstPost = () => ( - - - First Post - -

First Post

-

- - Back to home - -

-
-) - -export default FirstPost +export default function FirstPost() { + return ( + + + First Post + +

First Post

+

+ + Back to home + +

+
+ ) +}