React Native interview question · Most asked

How do you fetch data robustly on mobile networks?

Create a free account to save this page, take notes and track your progress. Sign in

Summary

Handle loading, empty, error and success states; use timeouts; retry only network errors, timeouts and 5xx with exponential backoff; cache responses and refetch in the background; and refetch when the app returns to the foreground or reconnects.

Longer Answer

TanStack Query provides caching, retries, deduplication and background refetching; in React Native, connect it to AppState (focus) and NetInfo (online status). Use AbortController to cancel stale requests (e.g. superseded searches).

Key Points

  • Four UI states.
  • Timeouts + selective retries with backoff.
  • Cache + background refresh; AppState and NetInfo wiring.

Deep dive: Mobile Apps with React Native and Expo: Fetching Data

More most-asked React Native questions

← All React Native questions

Was this page helpful?