The React component tree is the hierarchy of components your app renders, with one root component at the top and every other component nested inside its parent. React renders the tree by calling each function component, collecting the elements it returns, and repeating for every child until only built-in elements such as <div> remain. React DOM then turns that result into real DOM nodes.
Understanding the tree explains why data flows downward through props, why a state change re-renders a whole branch, and why React DevTools shows your app as nested boxes.
Every React app starts at a root component, usually named App. That component returns JSX that uses other components, and those components use others, until you reach plain elements like <h1> or <button>. Drawn as a diagram, the nesting forms a tree.
The component tree for this code is:
App is the root, each Profile is a child of App, and each Avatar is a child of its Profile. The same component can appear many times, so the tree has two Avatar nodes even though you wrote the function once.
Rendering means React calling your components to find out what should be on screen. It happens in two broad phases.
App, receives a tree of elements, and sees Profile elements inside. It then calls each Profile with its props, then each Avatar, going deeper until every element is a built-in element.The render phase only calculates. It must not change the page itself, which is one reason components should stay free of side effects.
On the first render React creates every DOM node. You trigger it by creating a root with createRoot and calling render:
createRoot and render come from react-dom/client. They are the entry point in React 18 and React 19, and they replace the old ReactDOM.render call, which React 19 removed.
When state changes, React re-renders the component that owns the state and, by default, all of its descendants. Siblings and ancestors outside that branch are not called again.
Clicking the button re-renders Counter only. Page and its <h1> are not called again, because the state lives in Counter. If the state lived in Page, the whole Page branch would re-render.
Data moves down the tree through props. A parent decides what each child receives, and a child cannot change its props. To send something upward, the parent passes down a function that the child calls.
This one-way flow makes the tree predictable: to find where a value comes from, look at the parent.
The tree also decides how React tracks identity. React matches components between renders by their position in the tree and by their key.
| Situation | What React does |
|---|---|
| Same component type at the same position | Keeps the instance and its state, updates props |
| Different component type at the same position | Unmounts the old one and mounts a new one, state is lost |
| Component removed from the tree | Unmounts it and discards its state |
List items with stable key values | Keeps each item's state even when the order changes |
This is why moving a component to a different place in the tree resets its state, and why list items need stable keys.
The React DevTools browser extension has a Components tab that shows the same tree you drew in your head. You can select a node to see its props and state, and the profiler highlights which components re-rendered after an update. It is the quickest way to confirm that a state change touches only the branch you expected.
No. The component tree contains your components, such as Profile, while the DOM tree contains only the HTML elements they produce. A component has no DOM node of its own unless it returns one.
No. React re-renders the component whose state changed and its descendants. Components above it or in other branches are not called again.
No. Each component instance has exactly one parent, which is what makes it a tree. You can reuse the same component in many places, but each use is a separate node.
The root is the component you pass to root.render, usually App. Above it React keeps an internal root node connected to the DOM container.
The component tree is the nested structure of components that makes up your React app, with one root and parents that pass props to children. React renders it by calling components from the root down, then commits the difference to the DOM. State changes re-render the owning component and its descendants, and a component's position in the tree decides whether its state is kept or reset.