React / UIIntermediate2 - 3 tháng

Nextjs

Lộ trình phát triển toàn diện Nextjs theo tiêu chuẩn quốc tế nilbuild/developer-roadmap

Hướng dẫn từng bước từ nền tảng đến chuyên sâu giúp bạn làm chủ Nextjs. Tích hợp tài liệu lý thuyết, bài viết thực chiến, video tham khảo và bài tập lập trình trực tiếp trên IDE.

Giai đoạn:5 Phases
Mô-đun:94 Kỹ năng
Thực hành:94 Bài Lab IDE
Tiêu chuẩn:nilbuild/roadmap
⚡ Trình biên dịch IDE trực tuyến: Làm chủ kỹ năng thông qua thực hành viết mã và kiểm thử tự động.
Mở IDE Thực Hành Lộ Trình Này →
Bộ lọc:
Thành thạo:0% (0/0)
01
Giai đoạn 1Xây dựng tư duy kiến trúc và công cụ nền tảng

Nền Tảng & Khái Niệm Cốt Lõi

Giai đoạn 1 tập trung hoàn thiện 19 chủ đề then chốt.

Cốt lõiIDE Lab

Adapter

Next.js can be adapted to run on different platforms to support their infrastructure capabilities, including AWS Amplify Hosting, Cloudflare, Deno Deploy, Netlify, and Vercel.

AdapterCoreEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Analytics

Next.js has built-in support for measuring and reporting performance metrics. You can either use the `useReportWebVitals` hook to manage reporting yourself, or alternatively, Vercel provides a managed service to automatically collect and visualize metrics for you.

AnalyticsCoreEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

API Endpoints

API Routes let you create an API endpoint inside a Next.js app. API endpoints work differently in Pages routers and App Routers: * Pages Router: Historically, Next.js used pages/api/* for APIs. This approach relied on Node.js request/response objects and an Express-like API. * App Router (Default): Introduced in Next.js 13, the App Router fully embraces web standard Request/Response APIs. Instead of pages/api/*, you can now place `route.ts` or `route.js` files anywhere inside the app/ directory.

APIEndpointsEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

App Router

The App Router is a file-system based router that uses React's latest features, such as [Server Components](https://react.dev/reference/rsc/server-components), [Suspense](https://react.dev/reference/react/Suspense), and [Server Functions](https://react.dev/reference/rsc/server-functions)

AppRouterEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Caching Data

Caching data in Next.js involves storing the results of data fetches so that subsequent requests for the same data can be served faster. Instead of repeatedly fetching data from a database or API, Next.js can retrieve it from the cache. This improves performance and reduces the load on your data sources. Caching can be configured at different levels. Caching behavior changes depending on whether the route is statically or dynamically rendered, data is cached or uncached, and whether a request is part of an initial visit or a subsequent navigation. Depending on your use case, you can configure the caching behavior for individual routes and data requests.

CachingDataEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Caching API Endpoints in Next.js

When you don't know the exact route segment names ahead of time and want to create routes from dynamic data, you can use Dynamic Segments that are filled in at request time or prerendered at build time. One example is catch-all segments, which allow you to extend API Routes to catch all subsequent paths.

CachingAPIEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

Client-Side Rendering in Next.js

Client-Side Rendering (CSR) means the browser receives a minimal HTML page from the server. The browser then downloads the JavaScript code, which is responsible for rendering the entire user interface. The JavaScript code fetches the data and dynamically generates the HTML content in the browser. This approach shifts the rendering workload from the server to the client's browser.

Client-SideRenderingEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Client-Side Data Fetching

Client-side data fetching involves retrieving data directly in the user's browser using JavaScript. This happens after the initial HTML content is loaded. When a user interacts with a page, or after a certain event, the browser makes a request to an API or data source. The fetched data is then used to update the user interface dynamically, without requiring a full page reload. Client-side data fetching is useful when your page doesn't require SEO indexing, when you don't need to pre-render your data, or when the content of your pages needs to update frequently. It's important to note that using client-side data fetching can affect the performance of your application and the load speed of your pages. This is because the data fetching is done at the time of the component or pages mount, and the data is not cached.

Client-SideDataEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Rendering Composition

Rendering composition is the practice of building complex user interfaces by combining smaller, reusable components. In Next.js, this is important because it allows you to strategically decide which parts of your application should be pre-rendered on the server for better performance and SEO, and which parts can be rendered on the client for dynamic interactivity. By composing components effectively, you can optimize the rendering strategy for each part of your application, leading to a faster and more efficient user experience.

RenderingCompositionEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

create-next-app

The create-next-app CLI allow you to create a new Next.js application using the default template or an example from a public GitHub repository. It is the easiest way to get started with Next.js.

create-next-appCoreEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Client-Side Rendering (CSR)

In Client-Side Rendering (CSR) with React, the browser downloads a minimal HTML page and the JavaScript needed for the page. The JavaScript is then used to update the DOM and render the page. When the application is first loaded, the user may notice a slight delay before they can see the full page, this is because the page isn't fully rendered until all the JavaScript is downloaded, parsed, and executed. After the page has been loaded for the first time, navigating to other pages on the same website is typically faster, as only necessary data needs to be fetched, and JavaScript can re-render parts of the page without requiring a full page refresh.

Client-SideRenderingEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

CSS in JS

It's possible to use any existing CSS-in-JS solution in your existing Next.js Apps and Pages. CSS-in-JS is a technique where CSS styles are written in JavaScript files instead of separate CSS files. This approach allows you to use JavaScript's dynamic capabilities to manage and scope your styles, often using libraries that generate CSS at runtime or build time. It offers benefits like component-level styling, dynamic theming, and easier management of CSS dependencies.

CSSinEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

CSS Modules

CSS Modules locally scope CSS by generating unique class names. This allows you to use the same class in different files without worrying about naming collisions.

CSSModulesEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

How to set up a custom server in Next.js

Next.js includes its own server with `next start` by default. If you have an existing backend, you can still use it with Next.js (this is not a custom server). A custom Next.js server allows you to programmatically start a server for custom patterns. The majority of the time, you will not need this approach. However, it's available if you need to eject.

HowtoEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Cypress

Next.js supports Cypress for End-to-End (E2E) and Component Testing. With Cypress, you can easily create tests for your modern web applications, debug them visually, and automatically run them in your continuous integration builds.

CypressCoreEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

Data Fetching Patterns in Next.js

There are a few recommended patterns and best practices for fetching data in React and Next.js, including: * Fetching data on the server. * Fetching data only where it's necessary. * Using React's streaming and Suspense features to progressively render and incrementally stream rendered units of the UI to the client. * Using parallel or sequential fetching depending on your particular use case. * Using preload data.

DataFetchingEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Deployment Options

Next.js can be deployed in multiple ways, including as a : * Node.js server, * Docker container, * static export, * adapted to run on different platforms.

DeploymentOptionsEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Docker Container

Next.js can be deployed to any provider that supports Docker containers. This includes container orchestrators like Kubernetes or a cloud provider that runs Docker. Docker deployments support all Next.js features.

DockerContainerEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Edge Runtime

The Edge Runtime is a lightweight JavaScript runtime environment based on V8, designed to execute code closer to the user. It allows you to run server-side logic, like API routes and middleware, on a globally distributed network of servers. This proximity reduces latency and improves the overall performance of your application by minimizing the distance data needs to travel.

EdgeRuntimeEngineering
1 khái niệmChi tiết
02
Giai đoạn 2Làm chủ các thư viện, framework và luồng xử lý chính

Kỹ Năng Trọng Tâm & Thực Hành

Giai đoạn 2 tập trung hoàn thiện 19 chủ đề then chốt.

Cốt lõiIDE Lab

Environment Variables

Environment variables are dynamic values that can affect the behavior of programs on a computer. They are typically used to store configuration settings, API keys, and other sensitive information that should not be hardcoded directly into the application's source code. This allows you to easily change the application's behavior without modifying the code itself, making it more flexible and secure across different environments like development, testing, and production. Next.js comes with built-in support for environment variables, which allows you to use `.env` to load environment variables, and bundle environment variables for the browser by prefixing with` NEXT_PUBLIC_`

EnvironmentVariablesEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Error States

Error states in Next.js routing refer to how your application handles situations where a route cannot be successfully loaded or rendered. Errors can be divided into two categories: expected errors and uncaught exceptions. Expected errors are those that can occur during the normal operation of the application, such as those from server-side form validation or failed requests. These errors should be handled explicitly and returned to the client. Uncaught exceptions are unexpected errors that indicate bugs or issues that should not occur during the normal flow of your application. These should be handled by throwing errors, which will then be caught by error boundaries.

ErrorStatesEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

ESLint

ESLint is an open-source static code analysis tool for JavaScript that identifies problematic patterns and style issues in your code, helping to enforce coding standards and prevent bugs before they occur Next.js provides an ESLint plugin, `eslint-plugin-next`, already bundled within the base configuration that makes it possible to catch common issues and problems in a Next.js application.

ESLintCoreEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

Fetching Location

Data fetching in Next.js allows you to render your content in different ways, depending on your application's use case. By default, layouts and pages are Server Components, which lets you fetch data and render parts of your UI on the server, optionally cache the result, and stream it to the client. When you need interactivity or browser APIs, you can use Client Components to layer in functionality. These include pre-rendering with Server-side Rendering or Static Generation, and updating or creating content at runtime with Incremental Static Regeneration.

FetchingLocationEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Font Optimization

The `next/font` module automatically optimizes your fonts and removes external network requests for improved privacy and performance. It includes built-in self-hosting for any font file. This means you can optimally load web fonts with no layout shift.

FontOptimizationEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Global CSS

Next.js provides several ways to style your application using CSS. One example is Global CSS, which refers to CSS styles that are applied across your entire application. This means that the styles defined in a global CSS file will affect all elements on every page of your website, unless specifically overridden by more specific CSS rules. It's a way to establish a consistent look and feel throughout your project.

GlobalCSSEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Handling Sensitive Data

Sensitive data, like API keys or user credentials, requires careful management to prevent exposure. In Next.js, you should avoid directly embedding such data in client-side code or committing it to your repository. Instead, leverage environment variables and server-side logic to securely access and utilize sensitive information, ensuring it remains protected from unauthorized access.

HandlingSensitiveEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Images

images account for a huge portion of the typical website’s page weight and can have a sizable impact on your website's LCP performance. The Next.js Image component extends the HTML <img> element with features for automatic image optimization, including: * Size Optimization: Automatically serve correctly sized images for each device, using modern image formats like WebP and AVIF. * Visual Stability: Prevent layout shift automatically when images are loading. * Faster Page Loads: Images are only loaded when they enter the viewport using native browser lazy loading, with optional blur-up placeholders. * Asset Flexibility: On-demand image resizing, even for images stored on remote servers

ImagesCoreEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

instrumentation

Instrumentation is the process of using code to integrate monitoring and logging tools into your application. This allows you to track the performance and behavior of your application, and to debug issues in production.

instrumentationCoreEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Intercepting Routes

Intercepting routes allows you to load a route from another part of your application within the current layout. This routing paradigm can be useful when you want to display the content of a route without the user switching to a different context. For example, when clicking on a photo in a feed, you can display the photo in a modal, overlaying the feed.

InterceptingRoutesEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Internationalization

Internationalization is the process of designing and developing applications that can be adapted to various languages and regions without engineering changes. Next.js enables you to configure the routing and rendering of content to support multiple languages. Making your site adaptive to different locales includes translated content (localization) and internationalized routes.

InternationalizationCoreEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Introduction

Next.js is a React framework that enables functionalities like server-side rendering and static site generation for web applications. It provides a structure for organizing React components, handling routing, and optimizing performance. Next.js simplifies the process of building production-ready, full-stack web applications with React.

IntroductionCoreEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

JavaScript Basics

JavaScript is a programming language that adds interactivity to websites. It allows you to create dynamic content, control multimedia, animate images, and much more. Think of HTML as the structure of a house, CSS as the interior design, and JavaScript as the electrical system that makes everything work. Understanding JavaScript is crucial before diving into Next.js because Next.js is built on top of React, which itself is a JavaScript library. Without a solid grasp of JavaScript fundamentals, you'll find it difficult to understand and effectively use Next.js's features and concepts.

JavaScriptBasicsEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Jest

Next.js allows you to use Jest for unit testing and snapshot testing. Jest is a JavaScript testing framework created by Facebook, designed for ensuring the correctness of JavaScript code, especially React applications. It provides a complete and easy-to-use solution for writing unit, integration, and end-to-end tests. Jest includes features like a test runner, assertion library, mocking capabilities, and code coverage reporting, making it a popular choice for developers looking to thoroughly test their code.

JestCoreEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Layouts and Templates

Layouts and templates provide a way to share UI elements across multiple pages, maintaining state and avoiding unnecessary re-renders. Layouts wrap around pages, persisting across route changes to preserve things like navigation bars or sidebars. Templates are similar to layouts in that they wrap each child layout or page. Unlike layouts that persist across routes and maintain state, templates create a new instance for each of their children on navigation. This means that when a user navigates between routes that share a template, a new instance of the component is mounted, DOM elements are recreated, state is not preserved, and effects are re-synchronized.

LayoutsandEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Lazy Loading

Lazy loading in Next.js helps improve the initial loading performance of an application by decreasing the amount of JavaScript needed to render a route. It allows you to defer loading of Client Components and imported libraries, and only include them in the client bundle when they're needed. For example, you might want to defer loading a modal until a user clicks to open it.

LazyLoadingEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Loading and Streaming

The special file `loading.js` helps you create meaningful Loading UI with React Suspense. With this convention, you can show an instant loading state from the server while the content of a route segment loads. The new content is automatically swapped in once rendering is complete. In addition to `loading.js`, you can also manually create Suspense Boundaries for your own UI components. The App Router supports streaming with Suspense for both Node.js and Edge runtimes.

LoadingandEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Markdown and MDX

Markdown is a lightweight markup language used to format text. It allows you to write using plain text syntax and convert it to structurally valid HTML. It's commonly used for writing content on websites and blogs. MDX is a superset of markdown that lets you write JSX directly in your markdown files. It is a powerful way to add dynamic interactivity and embed React components within your content. Next.js can support both local MDX content inside your application, as well as remote MDX files fetched dynamically on the server. The Next.js plugin handles transforming markdown and React components into HTML, including support for usage in Server Components (the default in App Router).

MarkdownandEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Memoization in Fetch

Memoization is an optimization technique that speeds up subsequent function calls by caching the results of previous calls with the same input parameters. This approach allows for re-use of data in a React Component tree, prevents redundant network calls and enhances performance For the initial request, data is fetched from an external source and the result is stored in memory Subsequent requests for the same data within the same render pass retrieve the result from memory, bypassing the need to make the request again.

MemoizationinEngineering
3 khái niệmChi tiết
03
Giai đoạn 3Kỹ thuật chuyên sâu, hiệu năng và chuẩn thiết kế

Kiến Trúc Nâng Cao & Tối Ưu

Giai đoạn 3 tập trung hoàn thiện 19 chủ đề then chốt.

Cốt lõiIDE Lab

Memory Usage

As applications grow and become more feature rich, they can demand more resources when developing locally or creating production builds. Next.js provides several strategies and techniques to optimize memory and address common memory issues in Next.js.

MemoryUsageEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

Metadata

The Metadata APIs can be used to define your application metadata for improved SEO and web shareability and include: * The static `metadata` object * The dynamic `generateMetadata` function * Special file conventions that can be used to add static or dynamically generated favicons and OG images.

MetadataCoreEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Middleware

Middleware is a powerful feature that allows you to intercept and run code on the server before a request is completed. Then, based on the incoming request, you can modify the response by rewriting, redirecting, modifying the request or response headers, or responding directly. Middleware executes before routes are rendered. It's particularly useful for implementing custom server-side logic like authentication, logging, or handling redirects.

MiddlewareCoreEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Next.js Routing Basics

Routing is the process of defining how an application responds to client requests to specific endpoints (URIs). In Next.js, routing is primarily file-system based. This means that the structure of your `pages` directory directly corresponds to the routes of your application. Each file in the `pages` directory becomes a route based on its filename. For example, a file named `about.js` in the `pages` directory will be accessible at the `/about` route.

Next.jsRoutingEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Next.js

Next.js is a React framework that provides extra features and optimizations on top of React for building web applications. It simplifies development by offering solutions for routing, data fetching, and server-side rendering out of the box. This allows developers to create performant and scalable web applications with less configuration.

Next.jsCoreEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Node.js Server

Next.js can be deployed to any provider that supports Node.js. You just have to build your application and start a Node.js server using simple commands. This server supports all Next.js features. If needed, you can also eject to a custom server. Node.js deployments support all Next.js features.

Node.jsServerEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Node.js

Node.js is a JavaScript runtime environment that executes JavaScript code outside of a web browser. It allows developers to use JavaScript for server-side scripting and to build scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it efficient and well-suited for real-time applications.

Node.jsCoreEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

OpenTelemetry

Observability is crucial for understanding and optimizing the behavior and performance of your Next.js app. With observability, developers can proactively address issues before they become major problems and provide a better user experience. Next.js recommends using OpenTelemetry for instrumenting your apps. It's a platform-agnostic way to instrument apps that allows you to change your observability provider without changing your code. Next.js supports OpenTelemetry instrumentation out of the box, which means that we already instrumented Next.js itself.

OpenTelemetryCoreEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Package Bundling

Bundling external packages can significantly improve the performance of your application. By default, packages imported inside Server Components and Route Handlers are automatically bundled by Next.js for enhanced optimization.

PackageBundlingEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Pages Router

The Pages Router in Next.js is a file-system based router built around the `pages` directory. Each file in the `pages` directory becomes a route based on its file name. For example, a file named `about.js` would create a route at `/about`. This approach simplifies routing by automatically mapping files to routes, making it easy to create and manage different pages within your application.

PagesRouterEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Parallel Routes

Parallel Routes allows you to simultaneously or conditionally render one or more pages within the same layout. They are useful for highly dynamic sections of an app, such as dashboards and feeds on social sites.

ParallelRoutesEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Parallel vs Sequential

When fetching data inside React components, you need to understand parallel and sequential data fetching. Parallel fetching starts independent requests at the same time, while sequential fetching runs requests one after another when later requests depend on earlier results. Choosing the appropriate pattern can reduce unnecessary waiting and improve application performance. @official@Parallel and sequential data fetching

ParallelvsEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Playwright

Next.js supports Playwright for End-to-End (E2E) testing. Playwright is a testing framework that lets you automate Chromium, Firefox, and WebKit with a single API. You can use it to write E2E testing.

PlaywrightCoreEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Preloading data

Another way to optimize data fetching is to use the preload pattern. You can optionally create a preload function to further optimize parallel data fetching. With this approach, you don't have to pass promises down as props. The preload function can also have any name as it's a pattern, not an API.

PreloadingdataEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Preparing for Production

Before taking Next.js application to production, there are some optimizations and patterns you should consider implementing for the best user experience, performance, and security. Next.js provides a list of best practices when building your application and before going to production. In addition, you should be aware of the automatic Next.js optimizations.

PreparingforEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Prettier

Prettier is an opinionated code formatter that supports many languages, including JavaScript, TypeScript, and CSS. It automatically formats your code to adhere to a consistent style, ensuring readability and maintainability across your project. The ESLint Plugin contains code formatting rules, which may conflict with your existing Prettier setup. To make ESLint and Prettier work together, you can include `eslint-config-prettier` in your ESLint config.

PrettierCoreEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

React Cache function

The React `cache` function allows you to memoize the return value of a function, allowing you to call the same function multiple times while only executing it once. `fetch` requests using the `GET` or `HEAD` methods are automatically memoized, so you do not need to wrap it in React `cache`. However, for other `fetch` methods, or when using data fetching libraries (such as some database, CMS, or GraphQL clients) that don't inherently memoize requests, you can use `cache` to manually memoize data requests.

ReactCacheEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

React Frameworks

React frameworks provide structure and tools to streamline the development of React applications. They offer solutions for common challenges like routing, data fetching, state management, and build processes, allowing developers to focus on building features rather than configuring infrastructure. These frameworks often include pre-built components, optimized performance configurations, and conventions that promote code organization and maintainability.

ReactFrameworksEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

Redirects in Next.js API Endpoints

Redirects in Next.js API endpoints allow you to send a user from one URL to another. This is useful for various scenarios, such as moving or renaming pages, handling temporary content changes, or guiding users to a different part of your application based on specific conditions. By sending an HTTP redirect response, the server instructs the client's browser to navigate to the new URL.

RedirectsinEngineering
3 khái niệmChi tiết
04
Giai đoạn 4Kiểm thử, CI/CD, đám mây và quy chuẩn sản xuất

Hệ Sinh Thái & Triển Khai Thực Tế

Giai đoạn 4 tập trung hoàn thiện 19 chủ đề then chốt.

Cốt lõiIDE Lab

Remix

Remix is a full-stack web framework that focuses on web standards and modern web development patterns. It emphasizes server-side rendering and progressive enhancement to deliver fast and resilient user experiences. Remix leverages web fundamentals like HTTP caching and distributed systems to build robust and performant web applications.

RemixCoreEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Rendering Pages in Next.js

Rendering refers to the process of converting your code into HTML that can be displayed in a web browser. Next.js offers different strategies for this, including server-side rendering (SSR), static site generation (SSG), incremental static regeneration (ISR), and client-side rendering (CSR). Each method determines when and where the HTML is generated, impacting performance, SEO, and interactivity. Choosing the right rendering strategy depends on the specific needs of each page in your application. Recently, Next.js has launched a partial prerendering feature, that allows you to combine static and dynamic content in the same route. This improves the initial page performance while still supporting personalized, dynamic data. However, this feature is currently experimental and subject to change, it's not recommended for production.

RenderingPagesEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Rendering Strategies

Rendering strategies determine how your application's user interface is generated and delivered to the user's browser. Different strategies offer varying trade-offs between performance, SEO, and data freshness. Choosing the right rendering strategy is crucial for optimizing your application based on its specific requirements and content characteristics.

RenderingStrategiesEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Revalidating Cached Data

Revalidation is the process of updating cached data. When you cache data, it's stored for a certain period. After that period, or based on specific events, you might want to refresh the data to ensure your application displays the most up-to-date information. Revalidation allows you to control when and how your cached data is updated, balancing performance with data freshness. Revalidating in Next.js is conducted through the `revalidatePath` and `revalidateTag` functions.

RevalidatingCachedEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Revalidation Errors

When revalidation fails, it means the attempt to refresh the cached data encountered an issue, preventing the application from displaying the most up-to-date information. These errors can stem from various sources, such as network connectivity problems, issues with the data source itself (e.g., a database being unavailable), or problems within the revalidation logic. In Next.js, If an error is thrown while attempting to revalidate data, the last successfully generated data will continue to be served from the cache. On the next subsequent request, Next.js will retry revalidating the data.

RevalidationErrorsEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Route Matcher

A route matcher in Next.js middleware allows you to conditionally execute middleware based on the incoming request's path. It defines specific patterns or conditions that the request path must satisfy for the middleware to run. This enables you to apply middleware logic only to certain routes or groups of routes within your application, providing fine-grained control over request handling.

RouteMatcherEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Routing Patterns

The App Router provides a set of conventions to help you implement more advanced routing patterns. These include: * Parallel Routes: Allow you to simultaneously show two or more pages in the same view that can be navigated independently. * Intercepting Routes: Allow you to intercept a route and show it in the context of another route. These patterns allow you to build richer and more complex UIs, democratizing features that were historically complex for small teams and individual developers to implement.

RoutingPatternsEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Routing Terminology in Next.js

In Next.js, routing is primarily handled through the `app` directory (introduced in Next.js 13) and the older `pages` directory. Key terms include: * **Route:** A specific URL path that maps to a particular component or page. For example, `/blog/my-first-post`. * **Route Segment:** A part of the URL path. In `/blog/my-first-post`, `blog` and `my-first-post` are route segments. * **File-System Routing:** Next.js uses a file-system based router. The structure of your directories and files within the `app` or `pages` directory directly defines your application's routes. * **Dynamic Routes:** Routes that include parameters, allowing you to create pages based on data. For example, `/blog/[slug]` where `[slug]` is a dynamic parameter. * **Index Route:** The route that is served when a user visits a directory. Typically represented by an `index.js` or `page.js` file within a directory. * **Layout:** A component that wraps multiple pages, providing a consistent UI structure (like headers and footers) across different routes. * **Link Component:** The `<Link>` component from `next/link` is used for client-side navigation between routes, providing better performance than traditional `<a>` tags.

RoutingTerminologyEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Runtimes and Types

In the context of Next.js, runtime refers to the set of libraries, APIs, and general functionality available to your code during execution. On the server, there are two runtimes where parts of your application code can be rendered: * The Node.js Runtime (default), which has access to all Node.js APIs and is used for rendering your application. * The Edge Runtime which contains a more limited set of APIs, used in Middleware.

RuntimesandEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Sass in Next.js

Sass (Syntactically Awesome Style Sheets) is a CSS preprocessor that extends the capabilities of standard CSS. It allows you to use features like variables, nesting, mixins, and functions to write more organized, maintainable, and efficient stylesheets. These features are then compiled into standard CSS that browsers can understand. Next.js has built-in support for integrating with Sass after the package is installed using both the `.scss` and `.sass` extensions. You can use component-level Sass via CSS Modules and the `.module.scss` or `.module.sass` extension.

SassinEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Third-Party Scripts

Third-party scripts are code snippets from external sources that add functionality to your website, such as analytics, advertising, or social media widgets. Next.js allows you to load a third-party script for multiple routes through the `next/script` component, optimizing performance and enhancing control over when and how scripts are executed within your application. These scripts can impact your website's performance because they often require downloading and executing code from external servers. Managing these scripts effectively is crucial for maintaining a fast and responsive user experience.

Third-PartyScriptsEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

Server Functions

Server Functions are asynchronous functions that are executed on the server. They can be used in Server and Client Components to handle form submissions and data mutations in Next.js applications. In an `action` or mutation context, they are also called Server Actions.

ServerFunctionsEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Server-Side Rendering (SSR)

Server-Side Rendering (SSR) is a technique where a web application's initial HTML is generated on the server in response to a user's request. This pre-rendered HTML is then sent to the client's browser, allowing the user to see the content immediately, even before the JavaScript code is fully executed. This approach contrasts with client-side rendering, where the browser downloads a minimal HTML page and then uses JavaScript to render the content.

Server-SideRenderingEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Server-Side Data Fetching for Locations

Fetching data on the server in Next.js allows you to retrieve location information before the page is rendered. This approach improves performance by reducing the amount of work the client's browser needs to do, leading to faster initial page loads and better SEO. Server-side data fetching ensures that the data is available when the page is initially rendered, providing a seamless user experience.

Server-SideDataEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Setting Headers in Next.js Middleware

Middleware in Next.js allows you to run code before a request is completed. Setting headers within middleware enables you to modify the HTTP response headers, controlling aspects like caching, security policies, or custom information passed to the client. This provides a flexible way to manage response behavior based on incoming requests.

SettingHeadersEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Setting Things Up

Next.js allows you to customize your project to meet specific requirements. This includes integrations with TypeScript, ESlint, and more, as well as internal configuration options such as Absolute Imports and Environment Variables.

SettingThingsEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

SPA vs SSR

Single-Page Applications (SPAs) load a single HTML page and dynamically update the content using JavaScript, providing a fluid user experience without full page reloads. Server-Side Rendering (SSR), on the other hand, generates the HTML on the server for each request, sending a fully rendered page to the client. Next.js allows you to choose between these approaches or even combine them, offering flexibility in optimizing for performance, SEO, and user experience.

SPAvsEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Single-Page Application (SPA) Rendering

A Single-Page Application (SPA) is a web application that loads a single HTML page and dynamically updates that page as the user interacts with the application. This is achieved by using JavaScript to manipulate the DOM (Document Object Model) directly, rather than requesting new HTML pages from the server for each interaction. This approach provides a more fluid and responsive user experience, as the browser doesn't need to reload the entire page for every change.

Single-PageApplicationEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Static Site Generation (SSG)

Static Site Generation (SSG) is a rendering method that generates HTML pages at build time. This means that when a user requests a page, the server sends a pre-rendered HTML file, rather than dynamically generating it on each request. This approach leads to faster load times and improved SEO, as search engines can easily crawl and index the static content.

StaticSiteEngineering
1 khái niệmChi tiết
05
Giai đoạn 5Các giải pháp quy mô lớn và tư duy dẫn dắt kỹ thuật

Chuyên Gia & Mở Rộng Hệ Thống

Giai đoạn 5 tập trung hoàn thiện 18 chủ đề then chốt.

Cốt lõiIDE Lab

Server-Side Rendering (SSR)

Server-Side Rendering (SSR) is a technique where a web application's HTML is generated on the server in response to each user request. The server then sends the fully rendered HTML to the client's browser, which displays it. This differs from client-side rendering, where the browser downloads a minimal HTML page and then uses JavaScript to render the content.

Server-SideRenderingEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

Static Assets

Static content is any file that is stored in a server and is the same every time it is delivered to users. HTML files and images are examples of this kind of content. Next.js can serve static files under a folder called `public` in the root directory. Files inside `public` can then be referenced by your code starting from the base URL (`/`). It's important to note that Next.js cannot safely cache assets in the public folder because they may change.

StaticAssetsEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Static Export

Next.js enables starting as a static site or Single-Page Application (SPA), then later optionally upgrading to use features that require a server. Since Next.js supports static exports, it can be deployed and hosted on any web server that can serve HTML/CSS/JS static assets. This includes tools like AWS S3, Nginx, or Apache. Running as a static export does not support Next.js features that require a server.

StaticExportEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Static vs Dynamic API Endpoints

API endpoints in Next.js allow you to create serverless functions that handle requests. These endpoints can be either static or dynamic, depending on how their routes are defined and how they process data. Static API endpoints have predefined routes and typically return the same response for every request, while dynamic API endpoints use parameters in their routes to handle different requests and generate responses based on those parameters.

StaticvsEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Streaming in Next.js API Endpoints

Streaming in Next.js API endpoints allows you to send data to the client in chunks, rather than waiting for the entire response to be generated on the server before sending anything. This can significantly improve perceived performance, especially for long-running processes or when dealing with large datasets. By sending data incrementally, the client can start processing and displaying information sooner, leading to a more responsive user experience.

StreaminginEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

Structuring Routes

Structuring routes in Next.js involves organizing your project's file system to define the different URLs (or routes) of your application. Each file within the `app` directory (or `pages` directory in older versions) corresponds to a specific route. The file's location and name directly determine the URL path that users will access. This file-system-based routing simplifies navigation and makes it easy to create a well-organized web application.

StructuringRoutesEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Tailwind CSS

Next.js support Tailwind CSS to style your apps. Tailwind CSS is a utility-first CSS framework that provides a set of pre-defined CSS classes that you can use to style your HTML elements directly in your markup. Instead of writing custom CSS rules, you compose styles by applying these utility classes, allowing for rapid UI development and consistent design. This approach promotes a more streamlined workflow by reducing the need to switch between HTML and CSS files.

TailwindCSSEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Third Party Libraries

`@next/third-parties` is a library that provides a collection of components and utilities that improve the performance and developer experience of loading popular third-party libraries, like Google Tag Manager and Google Analytics, in your Next.js application. All third-party integrations provided by `@next/third-parties` have been optimized for performance and ease of use.

ThirdPartyEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Types of Routers

Next.js has two different routers: * **App Router**: The newer router that supports new React features like Server Components. * **Pages Router**: The original router, still supported and being improved. Before Next.js 13, the Pages Router was the main way to create routes in Next.js. It's still supported in newer versions of Next.js, but Next.js recommends migrating to the new App Router to leverage React's latest features.

TypesofEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

TypeScript

TypeScript is a syntactic superset of JavaScript which adds static typing. This means that TypeScript adds syntax on top of JavaScript, allowing developers to add types. Next.js comes with built-in TypeScript, automatically installing the necessary packages and configuring the proper settings when you create a new project with create-next-app. To add TypeScript to an existing project, rename a file to `.ts` / `.tsx`. Run `next dev` and `next build` to automatically install the necessary dependencies and add a `tsconfig.json` file with the recommended config options.

TypeScriptCoreEngineering
3 khái niệmChi tiết
Cốt lõiIDE Lab

Middleware Use Cases

Middleware in Next.js allows you to run code before a request is completed. This provides a flexible way to modify the response by rewriting, redirecting, adding headers, or even directly responding. Common use cases include authentication, authorization, redirecting users based on their location (localization), handling bots, and implementing advanced security measures.

MiddlewareUseEngineering
2 khái niệmChi tiết
Khuyên họcIDE Lab

Using Cookies in Next.js Middleware

Cookies are small pieces of data that websites store on a user's computer to remember information about them, such as login details, preferences, or shopping cart items. In Next.js middleware, you can access and modify these cookies before a request is handled by your application's routes, allowing you to implement features like authentication, personalization, and A/B testing based on cookie values. This provides a powerful way to control the user experience at the edge.

UsingCookiesEngineering
1 khái niệmChi tiết
Cốt lõiIDE Lab

Videos in Next.js

Next.js provides various approaches and techniques to store and display video files without affecting performance. Videos can be embedded on the page using the HTML `<video>` tag for direct video files and `<iframe>` for external platform-hosted videos.

VideosinEngineering
1 khái niệmChi tiết
Khuyên họcIDE Lab

Vitest

Next.js allows you to use Vitest for unit testing. Vitest is a fast unit test framework powered by Vite. It offers a development experience similar to Vite, making it easy to set up and use in projects that already use Vite for building. Vitest focuses on speed and simplicity, providing features like instant hot module replacement (HMR) and built-in support for TypeScript and JSX.

VitestCoreEngineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Why Frontend Frameworks?

Building modern web applications often involves managing complex user interfaces, handling data efficiently, and ensuring a smooth user experience. Frontend frameworks like React, Angular, and Next.js provide a structured approach to these challenges. They offer pre-built components, routing solutions, state management tools, and optimized build processes, allowing developers to focus on building features rather than reinventing the wheel. This leads to faster development cycles, more maintainable code, and ultimately, better web applications.

WhyFrontendEngineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

Why Next.js?

Next.js is a React framework that provides extra features and optimizations beyond what React offers on its own. When choosing a framework built on React, Next.js stands out because it simplifies development with features like built-in routing, server-side rendering, and static site generation. These capabilities improve performance, SEO, and the overall developer experience compared to building a React application from scratch or using other frameworks that require more manual configuration.

WhyNext.js?Engineering
2 khái niệmChi tiết
Cốt lõiIDE Lab

Why React?

React is a JavaScript library designed for building user interfaces in a declarative and component-based way. It simplifies the process of creating dynamic and interactive web applications by allowing developers to break down complex UIs into smaller, reusable pieces. This approach promotes code maintainability, reusability, and efficiency, making it easier to manage and update large-scale frontend projects. React also works with tools like Redux for data management and React Native for mobile apps. It's popular because it's clear, fast, and has a big community.

WhyReact?Engineering
3 khái niệmChi tiết
Khuyên họcIDE Lab

App Router

The App Router in Next.js is a new routing system built on React Server Components, offering enhanced flexibility and performance compared to the traditional Pages Router. Before Next.js 13, the Pages Router was the main way to create routes in Next.js. It's still supported in newer versions of Next.js, but Next.js recommends migrating to the new App Router to leverage React's latest features.

AppRouterEngineering
3 khái niệmChi tiết