Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
Order of execution of react components

I'm trying to understand how things work under the hood inside components when I execute a program in react, and specifically the order of execution of code when a component is created. When I ask this question, people confuse the order of execution of code inside the component with the lifecycle of the component, an example of what I mean by the order of execution is the following:

function Test(){
    let testVar = 'testing';
    function test(){
        
    }
    return(
        <div className="test-element">I here just for testing purposes</div>
    )
}

let's say I have a component named 'Test' and this component renders an element, and inside the component decide to declare some variables and functions, my question is what happens when we run the program, do the elements returned get rendered to the screen then the code inside the component gets evaluated (i.e variables and functions declared) or the code inside the component is evaluated then the elements get rendered to the screen?

(If there is an issue with how the question is asked or anything unclear from my side, inform me please I'll try to clear it more for you)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda