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

227
Visualizações
Using redux and redux toolkit at same time

I just got new project where mostly it uses Redux, i changed my store to use 'configureStore' which comes from redux toolkit and everything works fine, but my reducers and actions are so large that i dont have time to convert those to use 'createslice', my question is in my reducers.ts file where i have all those 'switch' 'cases' can i use 'createslice' also there ? so i want to continue the project with 'createslice' and not convert those older codes to 'createslice' ? is it ok ?

English is not my mother language so could be mistakes.

Example code:

export function articleReducer(
  state = initialState,
  action: articleReducerAction
) {
 switch (action.type) {
    case ActionType.GET_A:
      return {
        ...state,
        books: action.payload,
      };
    case ActionType.GET_B:
      return {
        ...state,
        libraries: action.payload,
      };
      
       }
}

export const articleReducerr= createSlice({
  name: "app",
  initialState: {
    books: [],
    libraries: [],
  },
  reducers: {
    GET_C: (state, action) => {
      state.books = action.payload;
    },
    GET_D: (state, action) => {
      state.libraries = action.payload;
    },
 },
});

export const { GET_C, GET_D, } =
articleReducerr.actions;

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes, you can incrementally convert a project to Redux Toolkit one reducer or one function at a time, and it will all continue to work together. See https://redux.js.org/tutorials/fundamentals/part-8-modern-redux for an example.

(In fact, I work for https://replay.io , and our codebase at https://github.com/RecordReplay/devtools is absolutely a mixture of "modern" and "legacy" Redux patterns!)

That said, I'd definitely recommend trying to migrate more code to createSlice whenever possible.

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