Chapter quiz · Events & State

Test what you learned.

8 questions on Events & State. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Events & State — Chapter Quiz

Eight questions on event handlers, useState, lifting, and updates.

0/ 9
  1. Question 1
    1

    What is the final value of count after this click handler runs (starting count = 0)?

    function handleClick() {
      setCount(count + 1);
      setCount(count + 1);
      setCount(count + 1);
    }
    
  2. Question 2
    2

    Why doesn't count change immediately after setCount(count + 1)?

  3. Question 3
    3

    Calling items.push(x); setItems(items); triggers a re-render.

  4. Question 4
    4

    A Slider and a Readout should both see the same value. What's the right pattern?

  5. Question 5
    5

    For a controlled <input>, what TWO props do you wire?

  6. Question 6
    6

    What does this render when count is 0?

    <p>{count && <Badge>{count}</Badge>}</p>
    
  7. Question 7
    7

    Which is the right way to add an item to an array in state?

  8. Question 8
    8

    When the next state depends on the previous, use the updater form setCount(_______ => _______ + 1).

Pick an answer — instant feedback as you go.