#thedivisor#From the example app, we can construct the above render tree.#thedivisor#The tree is composed of nodes, each of which represents a component. <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">App</code>, <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">FancyText</code>, <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">Copyright</code>, to name a few, are all nodes in our tree.#thedivisor#The root node in a React render tree is the <a class="inline text-link dark:text-link-dark border-b border-link border-opacity-0 hover:border-opacity-100 duration-100 ease-in transition leading-normal" href="/learn/importing-and-exporting-components#the-root-component-file">root component</a> of the app. In this case, the root component is <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">App</code> and it is the first component React renders. Each arrow in the tree points from a parent component to a child component.#thedivisor#You’ll notice in the above render tree, there is no mention of the HTML tags that each component renders. This is because the render tree is only composed of React <a class="inline text-link dark:text-link-dark border-b border-link border-opacity-0 hover:border-opacity-100 duration-100 ease-in transition leading-normal" href="/learn/your-first-component#components-ui-building-blocks">components</a>.#thedivisor#React, as a UI framework, is platform agnostic. On react.dev, we showcase examples that render to the web, which uses HTML markup as its UI primitives. But a React app could just as likely render to a mobile or desktop platform, which may use different UI primitives like <a href="https://developer.apple.com/documentation/uikit/uiview" target="_blank" rel="nofollow noopener noreferrer" class="inline text-link dark:text-link-dark border-b border-link border-opacity-0 hover:border-opacity-100 duration-100 ease-in transition leading-normal">UIView</a> or <a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.frameworkelement?view=windowsdesktop-7.0" target="_blank" rel="nofollow noopener noreferrer" class="inline text-link dark:text-link-dark border-b border-link border-opacity-0 hover:border-opacity-100 duration-100 ease-in transition leading-normal">FrameworkElement</a>.#thedivisor#These platform UI primitives are not a part of React. React render trees can provide insight to our React app regardless of what platform your app renders to.#thedivisor#A render tree represents a single render pass of a React application. With <a class="inline text-link dark:text-link-dark border-b border-link border-opacity-0 hover:border-opacity-100 duration-100 ease-in transition leading-normal" href="/learn/conditional-rendering">conditional rendering</a>, a parent component may render different children depending on the data passed.#thedivisor#We can update the app to conditionally render either an inspirational quote or color.#thedivisor#With conditional rendering, across different renders, the render tree may render different components.#thedivisor#In this example, depending on what <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">inspiration.type</code> is, we may render <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px"><FancyText></code> or <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px"><Color></code>. The render tree may be different for each render pass.
#thedivisor#From the example app, we can build the render tree above.#thedivisor#The tree has nodes, and each node represents a component. App, FancyText, Copyright, for example, are all nodes in our tree.#thedivisor#The root node in a React render tree is the root component of the app. In this case, the root component is App, and it's the first component React renders. Each arrow in the tree points from a parent component to a child component.#thedivisor#You’ll see in the render tree above, there are no HTML tags mentioned for each component. This is because the render tree is only made of React components.#thedivisor#React, as a UI framework, works on any platform. On react.dev, we show examples that render to the web, which uses HTML markup as its UI basics. But a React app can also render to a mobile or desktop platform, which might use different UI basics like UIView or FrameworkElement.#thedivisor#These platform UI basics are not part of React. React render trees can help us understand our React app no matter what platform your app uses.#thedivisor#A render tree shows one render pass of a React application. With conditional rendering, a parent component can render different children based on the data passed.#thedivisor#We can change the app to conditionally show either an inspirational quote or color.#thedivisor#With conditional rendering, the render tree may show different components in different renders.#thedivisor#In this example, depending on what inspiration.type is, we may show <FancyText> or <Color>. The render tree can be different for each render pass.