Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
Why React renders my component a second time?

I have the following ReactJS code:

import React, { useState } from 'react';
import { render } from 'react-dom';

export default function App() {
    console.log('Render');

    const [isOpen, setIsOpen] = useState(false);

    const handleOpen = () => {
        setIsOpen(true);
    }

    return (
        <div>
            <button onClick={handleOpen}>Click</button>
        </div>
    );
}

render(<App />, document.getElementById('root'));

When the app loads in the browser "Render" is outputted in the console. Then, when I click on the button, "Render" is outputted another time, and it makes sense because the state changes.

However, another click on the button, outputs "Render" again in the console :/ And after that when clicking on the button, no more outputs.

Can someone help me understand why this component is rendered on the second button click?

Thanks

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda