A Note to a Writer

I first heard of Medium a couple of years ago. I wanted to write ever since, but the hesitation kept me from writing. I would scroll through the countless articles published. A notification would pop…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Understanding Server Components in React 18 and Next.js 13

Note that the /app folder in Next.js 13 is still in Beta.

Rendering converts the code that you write into user interfaces that the user interacts with. With React 18 and Next.js 13 there is a complete shift in how you can render React code.

Let’s revisit some terms and definitions before we understand the new rendering mechanisms with Next.js 13. Here is a quick recap.

The client refers to the browser on a user’s device, that sends a request to a server for your application code. It then turns the response from the server into an interface that the user can interact with.

The server refers to the computer in a data center that stores your application code, receives request from the client, does some computation, and sends back an appropriate response.

Got it! Tell me more..

Client Components are rendered on the client. In Next.js, client components can also be pre-rendered on the server and hydrated on the client.

To use a Client Component in Next.js, create a file inside /app and add the ‘use client’ directive at the top of the file, before any imports.

Here is an example of a Client Component /app/Counter.js.

Server Component is a new concept that has been introduced in React 18, and been adopted by the Next.js 13…

Add a comment

Related posts:

Surviving the Tempest

The small town of Oakville was enjoying a peaceful evening, with the sun slowly setting over the horizon. Aaron and Bill sat on their porch, sipping on cold beers and chatting about their day at…

test

test with first blog. “test” is published by moss.

How to choose the speaker that you love without hesitation

Who experienced control of the aux cable used to be a continuing discussion at every house get together or atlanta divorce attorneys taxi cab; but as Bluetooth speakers become a lot more popular —…