正在加载视频...

视频加载失败

React Server Components have gotten a lot of hate recently. I'm not saying they're perfect, but this short comparison shows why I still think they're compelling.

34,254 次观看 • 1 年前 •via X (Twitter)

12 条评论

Cory House 的头像
Cory House1 年前

Some replies said a comparison with React Query would be more “fair”. I agree. React Query is 🔥. But it’s not React. It’s one of many third-party libraries. RSC vs useEffect is me comparing old React to new React.

Soccer Bot™ 的头像
Soccer Bot™1 年前

Experience the bot completely reimagined. 🌟 A completely new design, reminders for match prediction, notifications when games are interrupted, continued or postponed. New commands like /features and /standings and new languages and much more.

Drew Hamlett 的头像
Drew Hamlett1 年前

Was this supposed to be for April 1st? Now do it with React query, or show the suspense boundary/error component you need for the error and loading state.

Cory House 的头像
Cory House1 年前

I discuss both in the video, and explain why they're not in this file. Also, your tone is lousy. Be kind.

Tanguy Krotoff 的头像
Tanguy Krotoff1 年前

You are missing the main advantage: you don't need to code a backend when using RSC. With client components, getPies() needs to perform an HTTP call to an API. With RSC, getPies() can directly call the database.

Cory House 的头像
Cory House1 年前

Great point - I should have mentioned

David Arteaga 的头像
David Arteaga1 年前

it feels a bit artificial to use an intentionally verbose example ignoring extremely common solutions like react-query RSC solve different issues I think this actually turns people away from trying them because the first thought is going to be: react query solves this

Cory House 的头像
Cory House1 年前

It’s not intentionally verbose. It’s old React vs new React. React Query is not part of React, and not necessarily something one is using. That said, I agree React Query resolves many issues.

Gnar Enjoyer 的头像
Gnar Enjoyer1 年前

No one is fetching data in a useEffect like that in real projects. This is a disingenuous example.

Cory House 的头像
Cory House1 年前

I literally audited an app today doing just this. As someone who reads a lot of real code it’s still unfortunately common

Sakil Sazzad Joy 的头像
Sakil Sazzad Joy1 年前

I don't think people hate server components. They hate the way nextjs introduced it and butchered the whole experience with caching. React server components solve a loooot more than just data fetching!

Cory House 的头像
Cory House1 年前

That's fair. I'm eager to see other mature implementations

相关视频