Skip to content

Lesson 05 · Cross-platform Mobile with React Native

Cross-platform: Data, APIs & Native Features

Fetch data with async/await, render loading, data and error states honestly, persist choices with AsyncStorage, branch per platform, and reach native features through Expo packages.

Prerequisites: Cross-platform: Navigation with React Navigation

Learning objectives
By the end of this lesson, you will be able to:
  • Refresher: read and write async/await with try/catch, including why fetch resolves on HTTP errors and how the response.ok check closes that gap
  • Render a fetch screen's three states - loading, data and error - as one status value, with empty handled as a flavor of data
  • Keep a fetch-in-effect stable with useCallback and an honest dependency array, and know why the naive version loops forever
  • Persist small values with AsyncStorage, hydrating on mount and writing on change
  • Branch per platform with Platform.OS, Platform.select and .ios.js/.android.js files, reach native features through Expo SDK packages, and know when Expo Go stops being enough