Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda