Challenge - 5 Problems
Advanced Frameworks Mastery
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 Server Component?
Consider this Next.js Server Component that fetches data and renders a list. What will be the rendered output?
NextJS
import React from 'react'; async function getData() { return ['apple', 'banana', 'cherry']; } export default async function FruitList() { const fruits = await getData(); return ( <ul> {fruits.map((fruit) => ( <li key={fruit}>{fruit.toUpperCase()}</li> ))} </ul> ); }
Attempts:
2 left
💡 Hint
Remember that Server Components can use async/await directly and the map transforms each fruit to uppercase.
✗ Incorrect
The component fetches the array ['apple', 'banana', 'cherry'] asynchronously, then maps each fruit to uppercase inside list items. The output is an unordered list with uppercase fruit names.
❓ state_output
intermediate2:00remaining
What is the displayed count after these React state updates?
In this React functional component using hooks, what number will be displayed after clicking the button twice quickly?
NextJS
import React, { useState } from 'react'; export default function Counter() { const [count, setCount] = useState(0); function increment() { setCount(count + 1); setCount(count + 1); } return ( <> <p>Count: {count}</p> <button onClick={increment}>Add 2</button> </> ); }
Attempts:
2 left
💡 Hint
Remember that React state updates are asynchronous and batched, so multiple setCount calls with the same value do not accumulate.
✗ Incorrect
Both setCount calls use the same stale count value (0), so the count updates to 1 only. Clicking twice quickly runs increment twice, but each call sets count to 1, so final count is 1.
📝 Syntax
advanced2:00remaining
Which option correctly uses Next.js 14 App Router server action syntax?
Next.js 14 introduces server actions for form handling. Which code snippet correctly defines a server action to handle a form submission?
Attempts:
2 left
💡 Hint
Server actions must be async functions and include the 'use server' directive inside the function body.
✗ Incorrect
Option D correctly defines an async function with 'use server' directive and accepts formData parameter. Option D misses 'use server'. Option D is not async. Option D misses formData parameter.
🔧 Debug
advanced2:00remaining
Why does this React component cause an infinite render loop?
Examine this React component. Why does it cause an infinite render loop?
NextJS
import React, { useState, useEffect } from 'react'; export default function Loop() { const [count, setCount] = useState(0); useEffect(() => { setCount(count + 1); }, [count]); return <p>Count: {count}</p>; }
Attempts:
2 left
💡 Hint
Think about what happens when state changes inside a useEffect that depends on that state.
✗ Incorrect
The useEffect runs after every count change and calls setCount to increment count, which triggers useEffect again, causing an infinite loop.
🧠 Conceptual
expert3:00remaining
Why do advanced patterns like React Server Components improve complex UI performance?
Select the best explanation for why React Server Components help solve performance issues in complex user interfaces.
Attempts:
2 left
💡 Hint
Think about where rendering happens and how that affects client load and interactivity.
✗ Incorrect
React Server Components render UI on the server, sending minimal HTML to the client. This reduces JavaScript bundle size and speeds up initial load, improving performance for complex UIs.