fso/projects

← back to all projects

GitHub Repo Explorer (React Query)

Part 6 — State Management

Why This Project

The Kanban projects dealt with client state. This project is about server state — data that lives on a remote server and needs fetching, caching, refetching, and syncing. The GitHub API is perfect for learning React Query because it has rate limits (forces you to think about caching), deeply linked data (user → repos → commits → contributors), and paginated endpoints. You'll hit real-world constraints that make caching feel necessary instead of optional.

What to Build

An explorer that lets you search GitHub users, browse their repos, and drill into repo details (recent commits, contributors, languages used). Users can "star" repos locally to build a personal list of interesting projects. Navigating between pages should feel instant on repeat visits because React Query caches the responses. The app should gracefully handle GitHub's rate limit (60 requests/hour unauthenticated).

Requirements

Skills Practiced

React Query useQuery useInfiniteQuery query keys staleTime caching pagination rate limiting server state vs client state dependent queries

Pain Point to Notice

Think about how you would build this with just useState + useEffect. For each page you'd need: isLoading, isError, data, and a useEffect that fetches. Multiply that by every entity (user, repos, commits, contributors). Then add pagination state. Then add caching so going "back" doesn't re-fetch. Then handle rate limits without losing already-fetched data. React Query gives you all of this for free. The moment you navigate from a repo page back to the user page and it loads instantly from cache — that's the point. Also notice the difference between server state (GitHub data, managed by React Query) and client state (your starred list, managed by useState). They're fundamentally different kinds of state and should be managed by different tools.

Resources