0
0
NextJSframework~5 mins

Async server components in NextJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is an async server component in Next.js?
An async server component is a React component that runs on the server and can use async/await to fetch data before rendering. It helps deliver fully rendered HTML to the client for faster load times.
Click to reveal answer
beginner
Why use async server components instead of client components for data fetching?
Async server components fetch data on the server, so the client gets ready-to-use HTML. This reduces client work, improves performance, and avoids loading spinners or empty states on the page.
Click to reveal answer
intermediate
How do you define an async server component in Next.js?
You define it as an async function that returns JSX. For example: <pre>export default async function MyComponent() { const data = await fetch(...); return <div>{data}</div>; }</pre>
Click to reveal answer
intermediate
Can async server components use React hooks like useState or useEffect?
No, async server components run only on the server and do not support client-only hooks like useState or useEffect. Those hooks belong in client components.
Click to reveal answer
beginner
What happens if you try to fetch data inside a client component instead of an async server component?
Fetching data inside a client component happens after the page loads, causing loading states and slower content display. Async server components fetch data before sending HTML, improving user experience.
Click to reveal answer
What keyword do you use to define an async server component in Next.js?
Aasync function
Bclass
CuseEffect
Drender
Where do async server components run?
AOnly during build time
BIn the browser
CBoth server and browser
DOn the server
Which React hook is NOT allowed in async server components?
AuseContext
BuseState
CuseCallback
DuseMemo
What is a main benefit of async server components?
AMore client-side JavaScript
BSupports all React hooks
CFaster page load with pre-fetched data
DRuns only in the browser
How do async server components improve SEO?
ABy sending fully rendered HTML to crawlers
BBy hiding content behind JavaScript
CBy delaying rendering until client loads
DBy using client-side routing only
Explain how async server components work in Next.js and why they improve performance.
Think about where the data fetching happens and what the client receives.
You got /5 concepts.
    Describe the difference between async server components and client components in Next.js.
    Consider when and where code runs and how it affects the page.
    You got /5 concepts.