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

174
Vistas
How I can change the combineReducers depends the user type

I have the next rootReducer that's init the app with the data user and charge the init data for the plataform.

export const rootReducer = combineReducers({
auth: authReducer,
ui: uiReducer,
dashboard: dashboardReducer
});

But my problem is when the user coming I have the type of that user and with that type I want to charge the data for the dashboard depends that field, I trying with another reducer that charge the correspond reducer but I can't:

export const dashboardReducer = (state=initialState, action) => {

switch (action.type) {

    case types.dashboardAdmin:
        return {
            ...state,
            dashboard: {adminRootReducer}
        };

    case types.dashboardTeacher:
        return {
            dashboard: {teacherRootReducer}
        }

    case types.dashboardStudent:
        return {
            ...state,
            dashboard: {studentRootReducer}
        }
    
    default:
        return state;
  }

}

Every root reducer is a combineReducers but I can't return the correponds reducers:

export const teacherRootReducer = 
combineReducers({
admin: adminReducer,
});

I want to charge the correspond root for every type that set on my app.

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