rsnext/docs/index.mdx

58 lines
5.3 KiB
Text
Raw Normal View History

---
title: Introduction
description: Welcome to the Next.js Documentation.
---
Welcome to the Next.js documentation!
## What is Next.js?
Next.js is a React framework for building full-stack web applications. You use React Components to build user interfaces, and Next.js for additional features and optimizations.
Under the hood, Next.js also abstracts and automatically configures tooling needed for React, like bundling, compiling, and more. This allows you to focus on building your application instead of spending time with configuration.
Whether you're an individual developer or part of a larger team, Next.js can help you build interactive, dynamic, and fast React applications.
## Main Features
Some of the main Next.js features include:
| Feature | Description |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Routing](/docs/app/building-your-application/routing) | A file-system based router built on top of Server Components that supports layouts, nested routing, loading states, error handling, and more. |
| [Rendering](/docs/app/building-your-application/rendering) | Client-side and Server-side Rendering with Client and Server Components. Further optimized with Static and Dynamic Rendering on the server with Next.js. Streaming on Edge and Node.js runtimes. |
| [Data Fetching](/docs/app/building-your-application/data-fetching) | Simplified data fetching with async/await in Server Components, and an extended `fetch` API for request memoization, data caching and revalidation. |
| [Styling](/docs/app/building-your-application/styling) | Support for your preferred styling methods, including CSS Modules, Tailwind CSS, and CSS-in-JS |
| [Optimizations](/docs/app/building-your-application/optimizing) | Image, Fonts, and Script Optimizations to improve your application's Core Web Vitals and User Experience. |
| [TypeScript](/docs/app/building-your-application/configuring/typescript) | Improved support for TypeScript, with better type checking and more efficient compilation, as well as custom TypeScript Plugin and type checker. |
## How to Use These Docs
On the left side of the screen, you'll find the docs navbar. The pages of the docs are organized sequentially, from basic to advanced, so you can follow them step-by-step when building your application. However, you can read them in any order or skip to the pages that apply to your use case.
On the right side of the screen, you'll see a table of contents that makes it easier to navigate between sections of a page. If you need to quickly find a page, you can use the search bar at the top, or the search shortcut (`Ctrl+K` or `Cmd+K`).
docs: Rewrite Rendering Section and React Essentials Page (#51579) We initially wrote the [React page](https://nextjs.org/docs/getting-started/react-essentials) to introduce Server Components in the App Router, but over time, some implementation details have changed, and the information has become stale. The React team is working on adding new docs, so I'd like to change the narrative on the Next.js docs from "client vs. server components" to "writing code for the server and for the client" - and link back to the React documentation when it becomes available. As React developers, we're very familiar with writing code for the client, it's nice and simple. But doing so comes at the expense of not being familiar with the server. The aim of these docs is to help developers become proficient in both the client and server environments. I'd like to take it back to the foundations, and not use abstractions like SSG and CSR, MPAs or SPAs, as those terms come with their own set of assumptions that make it harder to understand how RSC works. Instead, we'll focus on the request lifecycle, show how application code flows from the server to the client, and discuss the trade-offs of doing operations in each environment. - [x] Page: Rendering Fundamentals - [x] Environments: Client and Server - [x] Request-response lifecycle - [x] Network Boundary - [x] Page: Server Components - [x] Benefits and use cases of server rendering - [x] How to use Server Components in Next.js - [x] How Server Components are rendered - [x] Static Rendering - [x] Dynamic Rendering - [x] Streaming - [x] Page: Client Components - [x] Benefits and use cases of client rendering - [x] How to use Client Components in Next.js - [x] How Client Components are rendered - [x] Initial vs. Subsquent navigation - [x] Page: Composition Patterns - [x] When to use client and server components - [x] Server Component Patterns - [x] Client Component Patterns - [x] Interleaving Client and Server Components - [ ] ~Diagrams~ will follow up with new PR. - [x] Set up redirects: https://github.com/vercel/front/pull/24917 --------- Co-authored-by: Térence Hollander <hollanderterence@gmail.com> Co-authored-by: shawnthwei <32075290+shawnthwei@users.noreply.github.com> Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-08-24 15:48:44 +02:00
To get started, checkout the [Installation](/docs/getting-started/installation) guide.
## App Router vs Pages Router
Next.js has two different routers: the App Router and the Pages Router. The App Router is a newer router that allows you to use React's latest features, such as Server Components and Streaming. The Pages Router is the original Next.js router, which allowed you to build server-rendered React applications and continues to be supported for older Next.js applications.
At the top of the sidebar, you'll notice a dropdown menu that allows you to switch between the **App Router** and the **Pages Router** features. Since there are features that are unique to each directory, it's important to keep track of which tab is selected.
The breadcrumbs at the top of the page will also indicate whether you're viewing App Router docs or Pages Router docs.
## Pre-Requisite Knowledge
Although our docs are designed to be beginner-friendly, we need to establish a baseline so that the docs can stay focused on Next.js functionality. We'll make sure to provide links to relevant documentation whenever we introduce a new concept.
To get the most out of our docs, it's recommended that you have a basic understanding of HTML, CSS, and React. If you need to brush up on your React skills, check out our [Next.js Foundations Course](/learn/foundations/about-nextjs), which will introduce you to the fundamentals.
## Accessibility
For optimal accessibility when using a screen reader while reading the docs, we recommend using Firefox and NVDA, or Safari and VoiceOver.
## Join our Community
If you have questions about anything related to Next.js, you're always welcome to ask our community on [GitHub Discussions](https://github.com/vercel/next.js/discussions), [Discord](https://discord.com/invite/bUG2bvbtHy), [Twitter](https://twitter.com/nextjs), and [Reddit](https://www.reddit.com/r/nextjs).