0
0
NextJSframework~5 mins

Server-side state passing in NextJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is server-side state passing in Next.js?
It means sending data from the server to the client during page rendering, so the page loads with the needed information already available.
Click to reveal answer
beginner
Which Next.js function is commonly used to fetch data on the server before rendering a page?
getServerSideProps is used to fetch data on the server at request time and pass it as props to the page component.
Click to reveal answer
intermediate
How does getServerSideProps help with SEO?
Because data is fetched on the server and included in the HTML sent to the browser, search engines can see the full content immediately.
Click to reveal answer
intermediate
What is the difference between getServerSideProps and getStaticProps in Next.js?
getServerSideProps runs on every request to fetch fresh data, while getStaticProps runs at build time to generate static pages.
Click to reveal answer
advanced
Why should you avoid putting sensitive information directly in the props returned by getServerSideProps?
Because props are sent to the client and can be seen by users, sensitive data should be kept secure and not exposed in props.
Click to reveal answer
Which Next.js function fetches data on the server for each request?
AuseEffect
BgetStaticProps
CgetServerSideProps
DgetInitialProps
What does server-side state passing improve in a Next.js app?
APage load speed and SEO
BClient-side animations
CBrowser caching
DCSS styling
Where is the data returned by getServerSideProps available?
AAs props in the page component
BOnly in the browser console
CIn the CSS files
DIn the database
Which method runs only once at build time in Next.js?
AgetInitialProps
BgetStaticProps
CuseEffect
DgetServerSideProps
Why avoid sending sensitive data in server-side props?
AProps cannot be accessed by the client
BProps are encrypted automatically
CProps are stored only on the server
DProps are visible to users in the browser
Explain how server-side state passing works in Next.js and why it is useful.
Think about how data is prepared before the page reaches the browser.
You got /4 concepts.
    Describe the difference between getServerSideProps and getStaticProps in Next.js.
    Consider when the data is fetched and how often.
    You got /4 concepts.