Feedback on Generated Redux hooks
Hey, I'm new to Redux/RTK and would like some feedback regarding two utility functions I wrote.
I'm a fan of custom hooks and saw that RTK can auto generate those. I'd like to emulate something similar but for a regular slice's selectors and actions.
I'd like to know:
- Is what I'm doing unconventional? If it is, is it bad practice (and why) or just not common but fine.
- Did I overlook some pitfalls? Like something that might cause unneeded/excessive re-renders?
- Just general thoughts on the overall approach or tips regarding the typings.
What I have right now can be used like this:
The utility functions look like this:
1 Reply
This is heavily inspired by how TkDodo uses Zustand, even tho this is redux.
I tried my best with the types of the utility functions, tho I feel they can probs be improved so any feedback regarding that would be massively appreciated.