8.
What is the purpose of the getStaticProps function in Next.js?
It configures the routing for the component.
It sets up server-side rendering for the component.
It fetches data at runtime and passes it as props to the component.
It fetches data at build time and passes it as props to the component.
Correct: D
The getStaticProps function is used to fetch data at build time in Next.js. It runs only on the server-side and not on the client-side. The fetched data is then passed as props to the component, making it available during static generation. This enables pre-rendering and improves performance as the data is available before the page loads.