0
0
NextJSframework~5 mins

What can run in server components in NextJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are Next.js Server Components?
Server Components are React components that run only on the server. They can fetch data, access the file system, and do heavy work without sending code to the browser.
Click to reveal answer
beginner
Can Server Components fetch data directly from a database?
Yes. Server Components can fetch data directly from databases or APIs because they run on the server where these resources are accessible.
Click to reveal answer
beginner
Can Server Components use browser-only APIs like localStorage or window?
No. Server Components run on the server and do not have access to browser-only APIs like localStorage or window.
Click to reveal answer
intermediate
What kind of code can run inside Server Components?
Any code that runs on the server can run inside Server Components, such as file system access, environment variables, and server-side logic.
Click to reveal answer
intermediate
Why should you use Server Components in Next.js?
They improve performance by reducing JavaScript sent to the browser and allow secure data fetching and processing on the server.
Click to reveal answer
Where do Next.js Server Components run?
AIn the browser only
BOn the server only
CBoth server and browser
DOn a separate client app
Which of these can Server Components do?
AAccess the file system
BUse localStorage
CListen to browser events
DManipulate the DOM directly
Can Server Components use React hooks like useState?
AOnly useState works
BYes, all React hooks work
CNo, useState is not supported in Server Components
DOnly useEffect works
Why avoid using browser APIs in Server Components?
AThey slow down the server
BThey are too complex
CThey are deprecated
DThey cause errors because server has no browser environment
What is a benefit of Server Components in Next.js?
ALess JavaScript sent to the browser
BMore client-side rendering
CFaster animations
DBetter offline support
Explain what kinds of code can run inside Next.js Server Components and why.
Think about what the server environment allows that the browser does not.
You got /4 concepts.
    Describe the main advantages of using Server Components in Next.js applications.
    Consider speed, security, and user experience benefits.
    You got /4 concepts.