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

295
Visualizações
Screen goes white after state change React, Redux, Redux-Thunk

I'm having an issue with React. when I get data by calling an API, data comes back perfectly fine, it loads and displays in a table. On the other hand, when I tried to add data to the DB using the user interface, it works, the request returns 200, and the data is in the database, but after all is finished on the React end, the screen turns white. The proper route still shows up in the browser, yet the screen for that route turns blank after, what only seems to be POST actions. Here is my code.

component code to add an event to the DB

const AddEventModal = (props: any) => {
  const dispatch = useDispatch();
  const onSubmit = (event: any) => {
    event.preventDefault();
    let eventData: Event = {
      eventName: event.target[1].value,
      location: event.target[2].value,
      eventDate: event.target[3].value,
      startTime: event.target[4].value,
      endTime: event.target[5].value,
    };

    dispatch(addingEventToDb);
    dispatch(addEventAsyncToDB(eventData));
    props.toggleShow = false;
  };

  return (
    <MDBModal
      show={props.basicModal}
      setShow={props.setBasicModal}
      tabIndex="-1"
    >
      ......tsx code
    </MDBModal>
  );
};

Here is what the Thunk looks like.

export const addEventAsyncToDB = (event:Event) => {
    return (dispatch:any) => {
        return addEvent(event).then(res => {
            dispatch(addedEventToDBAction(res?.data));
        })
    }
}

And here is the actual AJAX code thats being called

export const addEvent = async (event: Event) => {
    try{
        const res = await axios.post(`${baseURI}/Events`, event);
        return res;
    }
    catch(e){
        console.log(e);
    }
}
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