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

224
Vistas
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 Respuestas
Responde la pregunta

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 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