Using server components with external API
Unanswered
Yacare Caiman posted this in #help-forum
Yacare CaimanOP
If we use server components that fetch from an external API(e.g. from a expressJS backend) then send the response back to the client, does this slow the webpage more than using a client webpage? As the request goes from client->nextJS server->backend. Is it better to just use a client component?
4 Replies
if you are using server component and fetch the data from external backend, it will be sent back to the server first and not the client. So yes. This will slow the webpage more than using a client webpage. But you can use streaming and caching so that users can receive the website instantly before your backend finished returning data to the nextjs project.
Is it better to just use a client component?Yes. It depends if you want the benefit of server rendered component or not. Some people finds it easy to implement fullstack app with server component and client components, some people just go full SPA
Yacare CaimanOP
does the client component get entirely rendered in user's browser or the server renders some part of it already before sending the response?
the latter