-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add Redux Toolkit #638
base: master
Are you sure you want to change the base?
Add Redux Toolkit #638
Conversation
Thanks for the PR @markerikson! LGTM, but as mentioned in the issue, I will let @coryhouse and @kwelch give this a look as well. |
First, Hey @markerikson! I think the changes around I think the slice work is great, but it does not appear to be integrated. I think for the nature of this repo, it should be using one approach consistently. To help promote best practices and simplify the on-boarding experience. Having both approaches could be confusing to new comers, whom are the target demographic for this repo. |
@kwelch : right, it's not complete. I just wanted to show the basic pattern so that you folks would have that to work from, and you can complete the conversion from there. |
Overall, I really like the approach. Slices look amazing and extremely helpful for sharing which is a major pain point. Also the store configuration is much simpler and cleaner. |
Hi Mark - Thanks for the PR! I see good stuff in here I like such as the object form of mapDispatchToProps. You said this isn't ready for merge, so I'm unclear: What open issues are there? |
@coryhouse : per the earlier comment, I didn't try to clean up all the other existing logic, and I wasn't sure if there were other aspects of the codebase that might also need to be changed. The PR itself might be okay to merge, but I wanted to be clear that it wasn't a 100% complete conversion in and of itself. |
Pull Request Template
The code review checklist below is used for all pull requests.
Checklist
npm run build
)Details
This PR demonstrates how to convert the default example project to use Redux Toolkit, per #637 . It is not necessarily meant to be merged as-is, although if you'd like to use it as a starting point, please do so.
Changes
@reduxjs/toolkit
as a dependency, and removed the explicit dependencies onredux-thunk
andredux-immutable-state-invariant
(both of which are used internally by RTK)configureStore()
. This considerably simplified the store setup logic, removing the need for separate "dev" and "prod" functions.fuelSavingsSlice.js
that is equivalent to the existing sample reducer + actions + constants files, including porting the existing reducer tests to cover the new slice file.rootReducer
tocreateRootReducer
for claritymapDispatch
, which is our recommended way to bind action creators.