NewCode with Beto MCP

React Native | Tutorial Suspense | Data Fetching | SWR

Beto, April 9, 2022 · 2,754 views

Manually tracking in every component gets old fast. With React 18's Suspense and SWR, your components just render data and React handles the waiting: one fallback UI, zero loading booleans. In the video I build a React Native app that fetches random users from an API and renders them as cards, with Suspense showing the placeholder until everything is ready.

What's inside

  • Upgrade an Expo project to React 18 for Suspense support
  • Configure SWR globally with a fetcher and
  • Wrap your data-fetching UI in with a fallback
  • Build a reusable Card component for user data
  • Fetch and render a list of users from a free API
  • Ship components with no manual loading state logic at all

Resources

CourseReact Native course

Let's connect!

Had a win? Get featured on Code with Beto.Share your story