All products

Fetch API data in Expo with AI

Give a screen distinct behaviour for loading, empty results and failed requests, and decide whether it should keep the last good response.

Fetch API data in Expo with AI by describing what a person should see when a request takes ten seconds instead of one. For a departure board, yesterday’s times might be actively misleading. For saved recipes, the last successful response may be better than a blank screen.

The expo-data-fetching guide gives the agent a basis for that choice. A simple fetch may be enough for one screen. A query library becomes useful when screens share answers or need coordinated retries and refreshes.

What it does

  • Separate an empty list from a failed request.
  • Keep earlier results visible during a refresh.
  • Cancel work after someone leaves the screen.
  • Choose where to store a short-lived response.
  • Find a secret that should stay on the server.

Install and use

  1. Provide an Expo project, the intended endpoint and a sanitised sample response. Use test access if needed; never embed a private server key in the app.
  2. Try: “When the network drops on this recipe list, retain the last result and give the reader a way to try again.”
  3. Check three cases independently: valid records, no records and an unreachable service. Revisit the screen after each case.

FAQ

Source

Made by Expo. Original skill: expo-data-fetching, published on GitHub under the MIT licence.

View on GitHub