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

410
Visualizações
Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>` arrow-body-style
const loadUsers = () => {
  return function (dispatch) {
    axios
      .get(`${process.env.REACT_APP_API}`)
      .then((resp) => {
        console.log(resp);
        dispatch(getUsers(resp.data));
      })
      .catch((error) => console.log(error));
  };
};

I'm getting this error in the above code.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

If an arrow function's block only has one return statement, you can omit the block and the return keyword. According to the linter you're using, you need to indeed do that:

const loadUsers = () => function (dispatch) {
  axios
    .get(`${process.env.REACT_APP_API}`)
    .then((resp) => {
      console.log(resp);
      dispatch(getUsers(resp.data));
    })
    .catch((error) => console.log(error));
};
about 4 years ago · Santiago Trujillo Relatório
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