Overview - Static vs server-side data fetching
What is it?
Static and server-side data fetching are two ways to get data for a website built with Astro. Static fetching gets data once when the site is built, so the data stays the same for all visitors. Server-side fetching gets fresh data every time someone visits the page, so it can change often. Both methods help show information on the website, but they work differently in when and how they get the data.
Why it matters
Without these methods, websites would either show no data or always show outdated information. Static fetching makes sites very fast because data is ready before visitors arrive. Server-side fetching keeps data up-to-date but can be slower because it waits for data on each visit. Choosing the right method affects how fast and fresh a website feels, which impacts user experience and resource use.
Where it fits
Before learning this, you should understand basic web pages and how data can be shown on them. After this, you can learn about client-side data fetching, where data is loaded in the browser after the page loads. This topic fits in the journey of making websites that show dynamic or static content efficiently.