Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

produce() function needed in postAdded reducer? #6

Open
jonathan-graf opened this issue Jul 30, 2023 · 1 comment
Open

produce() function needed in postAdded reducer? #6

jonathan-graf opened this issue Jul 30, 2023 · 1 comment

Comments

@jonathan-graf
Copy link

I must start off this report by saying what an absolutely fantastic repository this is. You've done a remarkable job at breaking down rather complicated concepts and creating a reusable guide for all sorts of systems. You are a wonderful human.

Regarding the postAdded reducer, I understand that you are using a prepare() callback, so there is a reducer() callback as well. However in this doc, it says that createSlice uses createReducer which users immer so state changes can be "mutated" inside the function. What is your experience here? Did you add the immer produce() function for a reason?

@timofeysie
Copy link
Owner

HI @jonathan-graf , that's a pretty good fine. From my git commit message it seems that was added while converting part 6 to use TypeScript. Now, I'm not sure why I did that.
From the timing, it's possible that's when I started to use ChatGPT to speed things up a bit.

This was a learning exercise for me, as I was about to start a role using Redux and Typescript and wanted to use Redux Toolkit. So this repo was an attempt to get some experience with it.

I don't think actually that reducer is being used anywhere, so it must have been some experiment that slipped in to the codebase. I was trying to setup authentication so that I could host the app somewhere as a real world example, but I kind of ran out of time. Also, since React stopped supporting create-react-app, and there is a new version of the Toolkit 2.0, I think this whole repo needs to be re-done from scratch, which I will attempt. Probably this will be based on a vite starter.

What has your experience with Redux Toolkit and Typescript been like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants