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

243
Vistas
Possible to add a reducer that can read from multiple state slices?

I am using createSlice to create slices of state. Let's call them sliceA and sliceB. Mostly these slices are decoupled from each other. However I would like to create one reducer in sliceA that has (read) access to both sliceA and sliceB. Is this possible?

I know I can use extraReducers to accept actions that were not defined in the slice. But I think I would still be limited (in these extra reducers) to read only sliceA, and not sliceB.

Any idea how I could create a reducer that can read from both slices?

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

0

By default, you can't. Each slice reducer is a standalone encapsulated function that can only see its own state.

Per the Redux FAQ entry on "How can I share state across slices?", your main options are:

  • Reorganize the state tree so that all the needed state is in one place
  • Use an additional "top-level reducer" to run more logic
  • Put more of the relevant data into the action
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