Skip to content

How to understand a React component tree in an unfamiliar app

Find the root, map providers, follow props and context, locate state and data fetching, and use React DevTools to see what actually renders.

October 13, 2026 · 2 min read · RepoGrasp team

A React app is a tree of components. Understanding an unfamiliar one means knowing what renders where, where state lives, and how data and events move through the tree. Here's an approach that works for most React codebases, whether they use Vite, Next.js, Remix or React Native.

Find the root and its providers

Start where the app mounts: createRoot(...).render(...) in a Vite app, app/layout.tsx in Next.js, App.tsx in React Native. The root is usually wrapped in providers:

  • A router
  • A data client (TanStack Query, Apollo, Relay)
  • A store provider, for Redux (Zustand needs none)
  • Theme, internationalisation, authentication and feature flag providers

Each provider is a capability available to every component below it. List them.

Map the routes

The router defines the top-level screens. Find the route definitions (a routes file, file-based routes, or navigators in React Native) and list each screen with its component.

Pick one screen and map its tree

For one screen, sketch the tree three or four levels deep. Note for each component:

  • Props it receives and from where
  • State it owns (useState, useReducer)
  • Context it reads (useContext or custom hooks wrapping it)
  • Data it fetches (query hooks, loaders, Server Components)

Find where state lives

Most confusion in React apps is about state. For each important piece, find its owner: local component state, a parent passing it down, context, a global store, the URL (search params), or the server (cached query data). Then find every place that changes it.

Follow events upward

Children change parent state through callbacks passed as props (onChange, onSubmit). Trace a user action from the element's handler up through each callback until it reaches the state it changes or the API it calls.

Know your custom hooks

Custom hooks (useCart, useAuth, useCheckout) often hold most of the logic. Read them as you would services in a backend.

Server and Client Components

In Next.js App Router and other React Server Components setups, some components run only on the server and some in the browser (marked "use client"). Note the boundary for each part of the tree; it decides where data fetching and interactivity happen. See our Next.js App Router guide.

Use React DevTools

The Components panel in React DevTools shows the real rendered tree, with props, state and hooks for each component. Search for a component by name to see where it sits. The Profiler shows what re-renders when you interact.

Ask about the tree

Ask RepoGrasp "which components render the checkout page, where does the cart state live, and which components change it?" It reads the components and hooks and cites each one. Confirm with React DevTools, which shows what actually renders at runtime.

Try it.