Chapter quiz · Effects & Lifecycle

Test what you learned.

8 questions on Effects & Lifecycle. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Effects & Lifecycle — Chapter Quiz

Eight questions on useEffect, dependencies, cleanup, and fetching.

0/ 8
  1. Question 1
    1

    When does useEffect(fn, []) run?

  2. Question 2
    2

    An effect's cleanup function runs before the effect runs again, and on unmount.

  3. Question 3
    3

    An effect uses id and query. What goes in the dep array?

  4. Question 4
    4

    Which is the right way to fetch when an id prop changes?

  5. Question 5
    5

    An effect that needs no cleanup can omit the return.

  6. Question 6
    6

    A user types fast in a search box. The fetch for an old query resolves AFTER a newer one. What pattern guards against showing stale results?

  7. Question 7
    7

    When should you NOT use useEffect?

  8. Question 8
    8

    To get a reference to a DOM element from a component, use _______(null) and the JSX ref prop.

Pick an answer — instant feedback as you go.