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

210
Visualizações
is there a way to make custom confirm/alert in React that could be called inside the if statement in Reducer Fn

Is there a way to make a custom React component that could be used as a condition in Reducer function that is used in useReducer hook? I want to change native alert and confirm, that return true or false, however I cannot use It inside other hook only in the component, and I have a reducer function in a separate file, and quite complex logic in there and a function that triggers window.confirm like so

    return isHoliday(day) &&
        (msg
            ? window.confirm(
                  `a question to ask`
              )
            : true)

I have red many tutorials on how to make custom confirmation popup but they are all used inside components body not inside reducer, and I don't know how to return false from the component as i cannot have state or anything like that in the file with just reducer fn. Just a pseudo code with the steps needed would be great, I want to try to code it myself :) thanks

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