Recall & Review
beginner
What is a server component in Next.js?
A server component is a React component that runs only on the server. It can fetch data directly and send fully rendered HTML to the client, improving performance and SEO.
Click to reveal answer
beginner
How do you fetch data in a Next.js server component?
You fetch data by calling async functions directly inside the server component. Since it runs on the server, you can use native fetch or database queries without extra client-side code.
Click to reveal answer
intermediate
Why should you avoid fetching data inside client components in Next.js when using server components?
Fetching data in client components adds extra client-side loading and delays. Server components fetch data once on the server, sending ready HTML to the client for faster load and better SEO.
Click to reveal answer
intermediate
What happens if you use 'useEffect' to fetch data in a server component?
'useEffect' does not run in server components because it only runs in the browser. Data fetching in server components should be done with async/await directly in the component code.
Click to reveal answer
beginner
Can server components fetch data from external APIs and databases?
Yes, server components can fetch data from any source like external APIs or databases because they run on the server and have full access to backend resources.
Click to reveal answer
Where does data fetching happen in Next.js server components?
✗ Incorrect
Server components run on the server, so you fetch data directly with async functions inside them.
Why is data fetching in server components better for SEO?
✗ Incorrect
Server components fetch data on the server and send ready HTML, which search engines can read easily.
What happens if you try to use 'useEffect' in a server component?
✗ Incorrect
'useEffect' runs only in the browser, so it does not run in server components.
Which of these is a benefit of fetching data in server components?
✗ Incorrect
Fetching data on the server means the client gets fully rendered HTML faster.
Can server components access databases directly?
✗ Incorrect
Server components run on the server and can access databases directly.
Explain how data fetching works in Next.js server components and why it improves performance.
Think about where the code runs and what the client receives.
You got /4 concepts.
Describe the difference between fetching data in server components versus client components in Next.js.
Consider timing and where the data is fetched.
You got /4 concepts.