`TypedUseSelectorHook` is deprecated but official documentation still recommends using it
See original GitHub issueThe Static Typing documentation refers to the TypedUseSelectorHook
helper type, but if you import it from @types/react-redux
and hover over the import in VSCode, it’s marked as deprecated and you’re instructed to use createSelectorHook<State, Action>()
instead. I can submit a PR to update this if needed.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Use of createSelectorHook instead of deprecated ...
@Daniel I found out that TypedUseSelectorHook was deprecated accidentally. It's recommended that you use TypedUseSelectorHook instead of ...
Read more >Modern Redux with Redux Toolkit, June 2022 - Mark's Dev Blog
Configuring a Redux store is too complicated; Have to add a lot of packages to do anything useful ( redux-thunk , reselect ,...
Read more >How to use Redux with TypeScript
In this small tutorial, I will show you how to use Redux with TypeScript. Disclaimer: I want to do this tutorial as a...
Read more >Apr 12
We're tossing around the idea of marking `createStore` as deprecated. We have _no_ plans to remove it. But, we want to give people...
Read more >Usage With TypeScript
There are multiple possible approaches to type checking Redux code. This page shows our standard recommended patterns for using Redux and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure.
Purely as background, I think what happened was:
useSelector
anduseDispatch
hooks rely on the singletonReactReduxContext
in our own library, as doesconnect
connect
allowed passing a custom context instance as a prop, there was no way to use a custom context instance with the hookscreateSelectorHook
andcreateDispatchHook
APIs whose only purpose is to allow users to create a customized version ofuseSelector
anduseDispatch
with their own custom context instance instead ofReactReduxContext
@types/react-redux
package based on this wrong assumptionAnd so we had to step in and fix the incorrect update to the types.
@markerikson , awesome, thats where the confusion lies. My colleague thinks its deprecated, but from reading this very issue that he himself shared with me, it seemed the other way around.
Thank you.