Question · JavaScript and React course · Module 11: Data Fetching and APIs

The loading/error/data Pattern

How many state variables (useState) do we need in the standard data fetching pattern in React?

Answer options

  • Three: data, loading, and error
  • Four: data, loading, error, and status
  • One: data (contains all state information)
  • Two: data and loading

You can check the correct answer by solving this task in the CodeWorlds game.