0
0
Astroframework~5 mins

Static vs server-side data fetching in Astro - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is static data fetching in Astro?
Static data fetching means getting data at build time. The data is fetched once when the site is built, then saved as static files. This makes pages load very fast because no server work is needed when users visit.
Click to reveal answer
beginner
What does server-side data fetching mean in Astro?
Server-side data fetching means getting data when a user requests a page. The server fetches fresh data each time, then sends the page. This is good for data that changes often.
Click to reveal answer
beginner
Name one advantage of static data fetching.
Pages load very fast because data is already included in the built files. No waiting for server responses on each visit.
Click to reveal answer
beginner
Why might you choose server-side data fetching over static?
If your data changes often or depends on the user, server-side fetching gives fresh data every time the page loads.
Click to reveal answer
intermediate
How does Astro let you choose between static and server-side data fetching?
Astro uses special functions like getStaticPaths for static and server-only code for server-side fetching. You pick based on your data needs.
Click to reveal answer
When is static data fetched in Astro?
AOnly when the server restarts
BOn every user request
CAt build time
DWhen the user clicks a button
Which data fetching method gives the freshest data on each page load?
AStatic data fetching
BNone of the above
CClient-side data fetching
DServer-side data fetching
What is a downside of server-side data fetching?
APages load slower because data is fetched on each request
BData is never updated
CIt only works for static sites
DIt cannot fetch data from APIs
Which Astro function is used for static data fetching?
AgetServerSideProps
BgetStaticPaths
CuseEffect
DfetchData
If your site data rarely changes, which fetching method is best?
AStatic data fetching
BNo data fetching
CClient-side fetching
DServer-side data fetching
Explain the difference between static and server-side data fetching in Astro.
Think about when the data is fetched and how it affects page speed and freshness.
You got /4 concepts.
    When would you choose server-side data fetching over static in a real website?
    Consider websites like news or user dashboards.
    You got /4 concepts.