2 Quizzes•15 Questions

Learn React

React questions here focus on how rendering actually works: state, effects, keys and derived data, rather than memorising API names.

Written against React 18/19 function components.

What you will practise

  • Props, state and rendering
  • Hooks and their rules
  • Effects and dependencies
  • Lists, keys and derived state

React lesson

A short introduction to the ideas behind the quizzes, before you start practising.

React builds user interfaces out of components that describe what the UI should look like for a given state. Most confusion for newcomers comes from three ideas: how state updates work, what effects are for, and how lists should be keyed.

Key concepts

Components and JSX

A component is a function that returns markup written in JSX, which compiles to regular JavaScript function calls. Data flows into a component through props, which the component should treat as read-only.

function Greeting({ name }) {
  return <h1>Hello, {name}</h1>;
}

State updates are snapshots

Calling a state setter schedules a re-render; it does not change the variable you are currently holding. If the next value depends on the previous one, use the updater function form instead of reading the outer variable twice.

const [count, setCount] = useState(0);
// Wrong if called twice in one handler:
setCount(count + 1);
setCount(count + 1); // still uses the old count
// Correct:
setCount((c) => c + 1);
setCount((c) => c + 1);

useEffect synchronises with the outside world

An effect runs after render and is for things React does not manage directly: subscriptions, timers, fetching data. Its dependency array tells React when to re-run it, and returning a cleanup function undoes whatever the effect set up.

useEffect(() => {
  const id = setInterval(tick, 1000);
  return () => clearInterval(id);
}, []);

Keys identify list items

When rendering a list, React needs a stable, unique `key` per item to track which item is which across renders. Using the array index as a key breaks when items are reordered, inserted or removed.

items.map((item) => <li key={item.id}>{item.name}</li>)

Common mistakes

  • Mutating state directly (`items.push(x)`) instead of creating a new array or object, which React needs to detect the change.
  • Using the array index as a `key` for a list that can be reordered or filtered.
  • Missing dependencies in a `useEffect` array, causing the effect to use stale values.
  • Calling hooks conditionally or inside loops, which breaks React’s ability to track hook state between renders.

Quick recap

  • Props flow down and are read-only; state is owned and updated by the component that declares it.
  • Treat a state setter call as scheduling a future render, not an immediate mutation.
  • Use `useEffect` for synchronising with things outside React, and always clean up what you start.
  • Give list items stable, unique keys based on their data, not their position.

Ready to test this? Take the React Core Concepts quiz →

Roadmap

Work through the levels in order, or jump to where you are.

2

Basic

Core concepts

  • JSX
  • Props
  • State
  • Events

React Core Concepts

3

Intermediate

Hooks in depth

  • useEffect
  • useRef
  • useMemo
  • Custom hooks

React Hooks in Depth

React quizzes

Interactive React challenges

Hands-on activities: find bugs, complete code, order steps and match concepts.

All React challenges →

React articles

FAQ

Which React version is covered?

React 18 and 19 function components and hooks. Class components are not covered.

Do I need to know Next.js to take these quizzes?

No. These quizzes focus purely on the React library itself, not on meta-frameworks.

What is the most common mistake students make in React?

Misunderstanding the dependency array in useEffect, and mutating state directly. Our intermediate quizzes test both extensively.

Do you cover state management libraries like Redux or Zustand?

Not yet. The current roadmap focuses entirely on built-in React state (useState, useReducer, and Context).