Overview - What can run in server components
What is it?
Server components in Next.js are special React components that run only on the server. They can fetch data, access the file system, and perform server-side logic before sending the rendered HTML to the browser. Unlike client components, they do not include any JavaScript for the browser, making pages faster and lighter.
Why it matters
Server components solve the problem of slow page loads caused by heavy JavaScript running in the browser. Without them, every user must download and run all code, even parts that only need server access. This leads to slower experiences and more data usage. Server components let developers run code where it makes the most sense, improving speed and user experience.
Where it fits
Before learning server components, you should understand React basics and client components. After mastering server components, you can explore advanced data fetching, server actions, and full-stack React patterns in Next.js.