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

87
Vistas
Redux and redux toolkit having problem without using createslice

I wanted to ask can't we just simply use handwritten reducer in redux-toolkit as same as we use in redux js And then the rest of all thing I may keep according to tp redux-toolkit in store, but I don't how would I able to give initialState in configureStore please guide me I want to use same reducer function of redux handwritten instead of using createslice

Thank u

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

0

You can totally do that, and you can pass preloadedState into configureStore (although your hand-written reducer should have it's own "default state", as part of the method signature like function myReducer(state = initialState, action) { ... }).

But I'd seriously ask you to reconsider. There might be a one-off case where a hand-written reducer has so specific logic that the hand-written reducer actually makes sense, but in 99% of the cases, createSlice reduces the amount of code (often by a factor of 2-4), and it also makes a lot of common errors like accidentally mutating state impossible (in a hand-written reducer, that is not allowed and considered a bug, in a createSlice reducer it is totally okay and will lead to an implicit immutable update).

What is the exact reason why you don't want to use createSlice?

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