-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2114 from aryaemami59/withTypes
Introduce pre-typed hooks via `hook.withTypes<RootState>()` method
- Loading branch information
Showing
11 changed files
with
379 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,51 @@ | ||
import Provider from './components/Provider' | ||
import type { ProviderProps } from './components/Provider' | ||
import connect from './components/connect' | ||
import type { | ||
export type { | ||
Connect, | ||
ConnectProps, | ||
ConnectedProps, | ||
} from './components/connect' | ||
import type { | ||
SelectorFactory, | ||
Selector, | ||
MapStateToProps, | ||
MapStateToPropsFactory, | ||
MapStateToPropsParam, | ||
MapDispatchToPropsFunction, | ||
MapDispatchToProps, | ||
MapDispatchToPropsFactory, | ||
MapDispatchToPropsParam, | ||
MapDispatchToPropsNonObject, | ||
MergeProps, | ||
} from './connect/selectorFactory' | ||
import { ReactReduxContext } from './components/Context' | ||
import type { ReactReduxContextValue } from './components/Context' | ||
|
||
import { useDispatch, createDispatchHook } from './hooks/useDispatch' | ||
import { useSelector, createSelectorHook } from './hooks/useSelector' | ||
import { useStore, createStoreHook } from './hooks/useStore' | ||
|
||
import shallowEqual from './utils/shallowEqual' | ||
import type { Subscription } from './utils/Subscription' | ||
|
||
import Provider from './components/Provider' | ||
import { defaultNoopBatch } from './utils/batch' | ||
|
||
export * from './types' | ||
export { ReactReduxContext } from './components/Context' | ||
export type { ReactReduxContextValue } from './components/Context' | ||
|
||
export type { ProviderProps } from './components/Provider' | ||
|
||
export type { | ||
ProviderProps, | ||
SelectorFactory, | ||
Selector, | ||
MapStateToProps, | ||
MapStateToPropsFactory, | ||
MapStateToPropsParam, | ||
Connect, | ||
ConnectProps, | ||
ConnectedProps, | ||
MapDispatchToPropsFunction, | ||
MapDispatchToProps, | ||
MapDispatchToPropsFactory, | ||
MapDispatchToPropsParam, | ||
MapDispatchToPropsFunction, | ||
MapDispatchToPropsNonObject, | ||
MapDispatchToPropsParam, | ||
MapStateToProps, | ||
MapStateToPropsFactory, | ||
MapStateToPropsParam, | ||
MergeProps, | ||
ReactReduxContextValue, | ||
Subscription, | ||
} | ||
Selector, | ||
SelectorFactory, | ||
} from './connect/selectorFactory' | ||
|
||
export { createDispatchHook, useDispatch } from './hooks/useDispatch' | ||
export type { UseDispatch } from './hooks/useDispatch' | ||
|
||
export { createSelectorHook, useSelector } from './hooks/useSelector' | ||
export type { UseSelector } from './hooks/useSelector' | ||
|
||
export { createStoreHook, useStore } from './hooks/useStore' | ||
export type { UseStore } from './hooks/useStore' | ||
|
||
export type { Subscription } from './utils/Subscription' | ||
|
||
export * from './types' | ||
|
||
/** | ||
* @deprecated As of React 18, batching is enabled by default for ReactDOM and React Native. | ||
* This is now a no-op that immediately runs the callback. | ||
*/ | ||
const batch = defaultNoopBatch | ||
|
||
export { | ||
Provider, | ||
ReactReduxContext, | ||
connect, | ||
useDispatch, | ||
createDispatchHook, | ||
useSelector, | ||
createSelectorHook, | ||
useStore, | ||
createStoreHook, | ||
shallowEqual, | ||
batch, | ||
} | ||
export { Provider, batch, connect, shallowEqual } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.