Next.js · Senior · Question 65 of 75
Why shouldn't a server component fetch your own Route Handler (/api/products) for data?
- ✓Correct answer: It adds an extra HTTP round trip, and prerendering at build time fails because no server is listening
- 2Route Handlers can't return JSON
- 3Server components can't use
fetch
Explanation
Call the data source or a shared data-access function directly. Route Handlers are for external clients: mobile apps, webhooks, third parties.