1 - Getting Started With Next - Js
1 - Getting Started With Next - Js
js 1
Getting Started
Terms
Client components Server components
Client-side Rendering (CSR) Server-side Rendering (SSR)
Dynamic rendering Static rendering
Node.js runtime Static Site Generation (SSG)
Summary
• Next.js is a framework for building fast, and search-engine friendly applications.
• With Next.js, we can render our components on the server and return their content to
the client. This technique is called Server-side Rendering (SSR) and makes our
applications search-engine friendly.
• To further improve performance, we can pre-render pages and components that have
static data during the build and serve them whenever needed. This technique is called
Static Site Generation (SSG).
• The new app router in Next.js 13 makes it incredibly easy to create routes. We can
de ne route segments by creating directories. To make a route public, we add a page
le (page.js, page.jsx, or page.tsx) in the corresponding directory.
• Next.js provides the Link component to enable client-side navigation. This means as
the user navigates between pages, the new content is loaded quickly and smoothly
without the entire page being reloaded.
• Next.js 13 supports client and server components introduced in React 18. Client
components are rendered on the client within a web browser. This technique is
called Client-side Rendering (CSR) and it’s how traditional React apps work. Server
components are rendered on the server within a Node.js runtime. This technique is
called Server-side Rendering (SSR).
• All the components and pages in the /app directory are server components by
default. To make a component a client component, we add the ‘use client’ directive
on top of the component le.
• Server components are great for fetching data because they don’t require extra
server trips, making our application faster and more search-engine friendly.
• Next.js enhances the fetch() function by adding automatic caching. This boosts
performance and reduces the need to retrieve the same piece of data twice.
Key Commands