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

231
Vistas
How to handle asynchronous call in redux react application

I am beginner of react application. I need handle asynchronous call in my application.

For the implement asynchronous call is there any library for that ?

How to implement asynchronous call using library ?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

For the implement asynchronous call you can use following library with react-redux

  1. redux-thunk
  2. redux-promise
  3. redux-saga

You can learn asynchronous call handling using library documentation

over 4 years ago · Santiago Trujillo Denunciar

0

If you are using vanilla ReactJS and your App does not need any Flux or Redux to control the state of the App, you can use React life-cycle method componentWillMount for that with builtin fetch method or library like axios

If your Application needs Flux or Redux then I personally recommend Redux over Flux and you can use redux-thunk middleware for that. for example

const INCREMENT_COUNTER = 'INCREMENT_COUNTER';

function increment() {
  return {
    type: INCREMENT_COUNTER
  };
}

function incrementAsync() {
  return dispatch => {
    setTimeout(() => {
      // Yay! Can invoke sync or async actions with `dispatch`
      dispatch(increment());
    }, 1000);
  };
}

For more see http://redux.js.org/docs/advanced/AsyncActions.html

over 4 years ago · Santiago Trujillo Denunciar

0

Here is the documentation for how to use async actions : http://redux.js.org/docs/advanced/AsyncActions.html

You define it like so when configuring the store:

const store = createStore(
  rootReducer,
  applyMiddleware(
    thunkMiddleware
  )
)

And you use it in the actions like so:

function fetchAction(data) {
  // Return a function, this function will be activated the the thunk middleware with dispatch as parameter
  return function (dispatch) {
    // Dispatch some action before fetch (like setting loading)
    dispatch(requestData(data));

    // return a promise of the fetch
    return fetch('yoururl')
      .then(response => response.json())
      .then(json =>
        // dispatch a new action when you get your data
        dispatch(receivedData(data,json))
      ).catch (e = > 
        // you can also dispatch an error
        dispatch(errorData(data,e));
      )

  }
}
over 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