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

280
Vistas
Function will not execute after Swal.fire in React JS, why?

I am trying to get a function to excecute after clicking a confirmation button in a Sweet Alert component yet it does not excecute on the first try, I have to click again and then it will excecute, can't figure out why.

 function initialize(){setFundir(true)  //Esta es la función del Funditrón OJO QUE FUNCIONA
while (fundir) {
    console.log("Ejecutando Funditrón")

}}

function executeFunditron() {
    Swal.fire({
        title: '¿Seguro?',
        text: "Esto va a hacer que ésta computadora se realentice al punto de no funcionar.",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Ejecutar Funditrón',
        cancelButtonText: "Cancelar"
      }).then((result) => {
        if (result.isConfirmed) {
          Swal.fire(
            'Ejecutando Funditrón',
            'Que la Fuerza te acompañe.',
            'success',
          )
         
        }
       
      }).finally(()=> initialize())
     
}

No idea what I am doing wrong, I tried putting it inside the component, outside, I used then, no parenthesis, yes parenthesis, this is good.

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