Chapter 2

Shared Types + API Client

grit sync ties API + mobile together type-safely.

~14 min total2 lessonsAssignment

By the end of this chapter you'll be able to

  • Run grit sync
  • Generate a typed API client
  • Use React Query for data

Chapter assignment

Wire a typed fetch from mobile

Add a `useUsers()` React Query hook in your mobile app that calls your Grit API. Render the list on a screen. Verify TypeScript autocompletes the User fields.

See success criteria

Lesson 1 takes ~6 min.

Start chapter

Spot a typo? Have an idea?

Help us improve this chapter. One click opens a GitHub issue with this chapter's URL pre-filled — suggest a clearer wording, report a bug, or request a new lesson. The course keeps improving thanks to learners like you.

Suggest an improvement on GitHub