piotrwitek / react-redux-typescript-guide

The complete guide to static typing in "React & Redux" apps using TypeScript
https://piotrwitek.github.io/react-redux-typescript-guide/
MIT License
13.35k stars 1.09k forks source link

Suggestion: Examples for new redux hooks and react-router hooks #196

Closed C-Higgins closed 2 years ago

C-Higgins commented 4 years ago

Redux and React-Router have introduced new hooks that drastically change the standard patterns:

https://react-redux.js.org/api/hooks

https://reacttraining.com/blog/react-router-v5-1/

Some of these benefit from extra typescript typings that this guide could help with, such as useDispatch requiring you to pass the type of the dispatch for action type safety, or useSelector benefiting from a type override so you don't have to type the state parameter each call.

NickSevens commented 4 years ago

I would be very interested in this as well. @piotrwitek please consider adding an example for this as well!

piotrwitek commented 4 years ago

Hey @C-Higgins, thanks for creating this issue! I was already thinking about it and will definitely add new patterns as soon as I have some time.