Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!