#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#A partir do exemplo do aplicativo, podemos construir a árvore de renderização acima.#thedivisor#A árvore é composta por nós, cada um representando um componente. App, FancyText, Copyright, para citar alguns, são todos nós em nossa árvore.#thedivisor#O nó raiz em uma árvore de renderização do React é o componente raiz do aplicativo. Neste caso, o componente raiz é App e é o primeiro componente que o React renderiza. Cada flecha na árvore aponta de um componente pai para um componente filho.#thedivisor#Você notará que na árvore de renderização acima não há menção das tags HTML que cada componente renderiza. Isso acontece porque a árvore de renderização é composta apenas por componentes do React.#thedivisor#O React, como um framework de interface de usuário, é independente de plataforma. No react.dev, mostramos exemplos que rendem para a web, que usa marcação HTML como suas primárias de interface. Mas um aplicativo React poderia renderizar em uma plataforma móvel ou de desktop, que pode usar diferentes primárias de interface, como UIView ou FrameworkElement.#thedivisor#Essas primárias de UI de plataforma não fazem parte do React. As árvores de renderização do React podem fornecer informações sobre nosso aplicativo React independentemente da plataforma em que seu aplicativo renderiza.#thedivisor#Uma árvore de renderização representa uma única passagem de renderização de um aplicativo React. Com renderização condicional, um componente pai pode renderizar filhos diferentes dependendo dos dados passados.#thedivisor#Podemos atualizar o aplicativo para renderizar condicionalmente uma citação inspiradora ou uma cor.#thedivisor#Com a renderização condicional, em diferentes renderizações, a árvore de renderização pode renderizar componentes diferentes.#thedivisor#Neste exemplo, dependendo do que inspiration.type é, podemos renderizar <FancyText> ou <Color>. A árvore de renderização pode ser diferente para cada passagem de renderização.