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

109
Vistas
Handle complex async actions in Redux, and state discrepency

Let's say I have a state that looks like this:

enum PlayState {
    Playing,
    Paused,
    Error
}

const initialState = {
    playState:  PlayState.Playing,
};

This holds the state of the currently selected audio player. Using a control panel, user can change the state of the player from playing to paused and vice versa. Audio player react component listens to state changes and calls the audio player SDK (which can take a few seconds, and can error out potentially).

Since this is like an async procedure, can somehow async thunk be applied in this case, or the request, success, failure pattern? How to correctly handle discrepency between the TRUE state of the audio player, and the intended (requested) state?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Yes, it can be done using thunk, also using redux-observable, saga, suspense, hooks, and other approaches.

Here is a nice article showing examples with thunk, saga, suspense, and hooks: https://www.freecodecamp.org/news/loading-data-in-react-redux-thunk-redux-saga-suspense-hooks-666b21da1569

I think once you get familiar with even one of the above your problem will be a breeze to solve. :)

about 4 years ago · Juan Pablo Isaza 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