Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!