React Server Components
React Server Components represent a new paradigm for working with components in Next.js that eliminates isomorphic JavaScript. The code of such components runs only on a server and can be cached as a result. In this concept, you can directly read the server’s filesystem or access the database from the components.
In Next.js, React Server Components allow you to categorize components into two types: server-side and client-side. Server-side components are processed on a server and sent to the client as static HTML, reducing the load on the browser. Client-side components still have all the capabilities of browser JavaScript but with one requirement: you need to use the use client
directive at the beginning of the file.
To use server-side components in Next.js, you will need to create a new project. For routing, you still use files, but now, the main folder for the project is the app
folder, and route names are based solely on folder names. Inside...