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

417
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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