Migrate from Redux to Redux RTK
No milestone needed
Context
Redux is a library that helps manage the global state of your application. Although it's extremely reliable, it's been criticized in the past for creating overly verbose code with a lot of boilerplate. In recent years, the maintainers of Redux have come out with a new library called Redux Toolkit (RTK) that addresses most, if not all, of the common complaints. My favorite highlight is that RTK generates action creators for you, allowing the removal of A TON of boilerplate.
more on this article : https://shopify.engineering/react-redux-toolkit-migration
Benefits:
- no more actions -> less code and less files
- mutable syntax
- easier onboarding
- cleaner debugging with scoped actions ex: modal/openFeedbackModal
This issue is the continuation of !841 (merged).
Resources
udemy course migrating to RTK
https://redux.js.org/usage/writing-tests#unit-testing-individual-functions
Tasks
Reducers to update :
-
challenge !902 (merged) -
chart !897 (merged) -
global !931 (merged) -
modal !876 (merged) -
profile !966 (merged) -
profileEcogesture !967 (merged) -
profileType !906 (merged)
Deprecated message :
-
createStore
is deprecated. We recommend using theconfigureStore
method of the@reduxjs/toolkit
package, which replacescreateStore
. This should allow us to remove AppActionsTypes. This should also allow us to disable dev tools in prod builds -> !969 (merged)
Other :
-
Typed hooks While it's possible to import the RootState and AppDispatch types into each component, it's better to create typed versions of the useDispatch and useSelector hooks for usage in your application. !943 (merged)
Once all reducers are slices, we can probably
-
refactorAppActionsTypes
-
Add action creators to redux extensions to quick dispactch actions in app example here !914 (merged)
Example
Merge request template name
Use a similar name adjusting the context : refactor(redux-rtk): modal