Server Rendering
Objective
- Server components.
- Server-side rendering (SSR).
- Dynamic and static rendering.
- Conditional rendering.
1 Country Facts
Tailwind CSS will be used for presentation. It can be automatically included and configured when creating your applications.
Figure 1 (opens in a new tab): Country facts using server (static) rendering
- 
Reimplement the 7.2 Country Facts application, using React and Next.js. npx create-next-app@latest 01-country-facts --turbopack --app --javascript --tailwind --eslint --no-src-dir --import-alias "@/*"
- 
Use a dynamic route with optional catch-all slug (opens in a new tab), [[...slug]], to handle routing and navigation.
- 
Implement the generateStaticParams()function to generate paths for the root page, all regions, all subregions, and all countries.
- 
Apply different rendering methods, such as dynamic and static, to render the facts for every country. 
- 
Build your application using npm buildthen start it usingnpm start. Take note of the observed differences.
- 
Export your application by first updating next.config.mjs, then runningnpm build:next.config.mjsconst nextConfig = { output: "export", };
- 
Install serve(opens in a new tab) and use it to serve the staticoutdirectory.
2 Task Tracker
Reimplement the 8.1 Task Tracker application, using React and Next.js.
3 Bank Accounts
Reimplement the 8.2 Bank Accounts application, using React and Next.js.
Resources
- React: Learn React: Quick Start (opens in a new tab), React Reference Overview (opens in a new tab), Server Components (opens in a new tab), Server Functions (opens in a new tab), Conditional Rendering (opens in a new tab)
- Next.js: Start building with Next.js (opens in a new tab), React Foundations (opens in a new tab), Learn Next.js (opens in a new tab), Rendering (opens in a new tab), Server Rendering Strategies (opens in a new tab)
- Get started with Tailwind CSS (opens in a new tab)
- Vercel Guides (opens in a new tab)
- Origins of JSX and Why It Exists (opens in a new tab)
- React, Visualized (opens in a new tab)