liveBook · Manning

Next.js

As explained in React in Depth

A React framework for building full-stack web applications with features including routing, server rendering, and build tooling.

Next.js is a React website framework for full-stack applications. Server-side rendering can reduce data-transfer round trips, render pages before browser-side React starts, and improve speed, retention, search-engine optimization, and user experience. section 11.0

A Pages Router application typically combines:

  • Route files in the pages folder, each exporting a default React component. section 11.3.2
  • A getServerSideProps function beside the component to load route data on the server and pass it as props. section 11.3.2
  • Dynamic URL segments such as /pages/shop/[categoryId].jsx, whose parameters select data for the rendered page. section 11.3.2
  • Redirect handling when requested data is unavailable, plus cookies, external services, and APIs where the application requires them. section 11.3.2 section 11.3

Weather application

A weather app demonstrates the architecture by using URLs for a front page, country pages, and city pages; loading weather data on the server; reusing it on the client; persisting local state in a cookie; and exposing an API for React-server interaction. section 11.3

Figure 11.7 The Pages Router part of the documentation. If the menu heading is Using App Router, you can't use whatever information you read in a Pages Router–based application.
figure

Use the Pages Router documentation for this implementation; App Router guidance targets the newer React Server Components model and does not directly apply. section 11.2.1

How React in Depth covers it

How deep it goes
Explains server-rendering motivation and implements Pages Router data flow, while deferring substantial framework details to documentation.
Examples
Builds a weather app with front-page, country, and city routes plus server-loaded weather data.
What you can do after
Builds a server-rendered application using Next.js Pages Router routes and getServerSideProps.
How it connects
Connects routing, server-side rendering, cookies, APIs, React Server Components, and Remix.

Also explained in

Compare how 3 books explain Next.js →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of React in Depth. The section links point to the parts of the book it draws on.