From the course: Master Next.js by Building Scalable Apps with Routing, Databases, and Performance

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

RQ: React server component vs. client component

RQ: React server component vs. client component

Explain the difference between the client component and server component. A client component is rendered on the browser, which means it executes after the page is loaded, whereas the server components are rendered on the server and send the rendered HTML to the client. Client components will be sent as JavaScript to the client that is browser to run, whereas server component does not include JavaScript while sending the interface to the client, it will have HTML only. We can handle JavaScript events that are triggered by user actions, system interactions, or other changes using the client component, whereas using the server components, we can render only static data or fetch the data on the server before rendering the page. The client components are slower because of the JavaScript sent to the client and the fact that the rendering speeds also depend on the client device's performance, whereas server components are faster because it directly sends rendered HTML page to the client.

Contents