CMS + Next.js: Client-Side Rendering (CSR)
This section explains the principles and benefits of client-side rendering in web applications.
When to use CSR?
Client-side rendering (CSR) is particularly useful when you want to achieve the following:
- Dynamic Interactivity: CSR allows for highly interactive applications where users can interact with the UI without requiring full page reloads.
- Rich User Experience: CSR enables a more fluid and responsive user experience.
- Reduced Server Load: By offloading rendering to the client, CSR can reduce the load on the server.
- Asynchronous Data Fetching: CSR allows for fetching data asynchronously.
- Improved Performance for Certain Use Cases: CSR can improve performance for applications that require frequent updates or interactions.
How to implement CSR in Next.js with Apollo Client
-
Add
"use client"at the top of your file. -
Fetch data with
useQuery. -
Render loading and error states.
SSR Fetching
This section provides an overview of how to implement server-side rendering (SSR) in a Next.js application using Apollo Client to fetch and display CMS data.
CMS Migration
This section explains how to migrate content from an existing CMS to the Erxes CMS.