Challenge - 5 Problems
Next.js Static Rendering Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What is the output of this Next.js static page?
Consider this Next.js component using default static rendering. What will the user see when visiting the page?
NextJS
export default function Home() { return <h1>Welcome to Next.js!</h1>; }
Attempts:
2 left
💡 Hint
Static rendering means the page is pre-built and served as is.
✗ Incorrect
By default, Next.js statically renders pages without data fetching methods. The component renders immediately with the returned JSX.
❓ state_output
intermediate2:00remaining
What happens to state in a statically rendered Next.js page?
Given this component, what will be the initial displayed count when the page loads?
NextJS
import { useState } from 'react'; export default function Counter() { const [count, setCount] = useState(5); return <p>Count: {count}</p>; }
Attempts:
2 left
💡 Hint
State initializes on the client after static HTML is loaded.
✗ Incorrect
Static rendering builds the HTML with no state, but React hydrates on the client and initializes state as coded. So the initial count is 5.
📝 Syntax
advanced2:30remaining
Which code snippet correctly uses static rendering with data fetching?
Select the code that correctly fetches data at build time for static rendering in Next.js.
Attempts:
2 left
💡 Hint
Static rendering with data requires getStaticProps function.
✗ Incorrect
getStaticProps runs at build time to fetch data for static pages. getServerSideProps runs on each request (not static). Async components are not supported in Next.js pages. Fetching inside component without await returns a Promise, not data.
🔧 Debug
advanced2:30remaining
Why does this statically rendered page show stale data?
This Next.js page uses getStaticProps to fetch data. After deployment, the data changes on the server but the page still shows old data. Why?
NextJS
export async function getStaticProps() { const res = await fetch('https://api.example.com/data'); const data = await res.json(); return { props: { data } }; } export default function Page({ data }) { return <div>{data.title}</div>; }
Attempts:
2 left
💡 Hint
Static pages do not update automatically after build.
✗ Incorrect
getStaticProps runs only at build time. The page is pre-built and served as static HTML. To update data, you must rebuild or use incremental static regeneration.
🧠 Conceptual
expert3:00remaining
Which statement best describes Next.js static rendering behavior?
Choose the most accurate description of how Next.js static rendering works by default.
Attempts:
2 left
💡 Hint
Think about what 'static' means in web pages.
✗ Incorrect
Static rendering means pages are built once at build time into HTML files. These files are served directly by the server or CDN without running server code per request.