/next-13

Primary LanguageTypeScript

This is a Next.js project bootstrapped with create-next-app using the version 13.3. This project was created just to study new functions of the NextJS, as App Directory, React Server Components, Layouts, etc. For this studies I followed this video

Anotations

  • To create new pages to the application now all files inside the folder app that contains "page" will be transformed in pages
  • The layouts allow we create wrappers to pages inside in determinate scope (folder). If we don't wanna that folder affect our route, we could create the folder with brackets like: (auth) and the routes will be /login instead /auth/login
  • We can continue using dynamic routes and in next 13.2 introduces the Metadata API to improvement SEO
  • SSG/SSR: Now instead create a function called getStaticPageProps the Next uses SSG in async functions of the component, like that:
    • export default async function User({ params }: UserProps) {
      ...
      }
      
    • To revalidate whole the page we can export a variable outside the default function called revalidate.
    • We also can revalidate and handle cache to a specific fetch usign the default fetch of the browser, that has been extended.
  • Server side components: The new components can be executed on server-side! We just need transform the function to async like pages