|
1 | 1 | import { useReducer, useRef, useEffect, useMemo, useLayoutEffect } from 'react'
|
2 | 2 | import invariant from 'invariant'
|
3 |
| -import { useReduxContext as useDefaultReduxContext } from './useReduxContext' |
| 3 | +import { useReduxContext } from './useReduxContext' |
4 | 4 | import Subscription from '../utils/Subscription'
|
| 5 | +import { ReactReduxContext } from '../components/Context' |
5 | 6 |
|
6 | 7 | // React currently throws a warning when using useLayoutEffect on the server.
|
7 | 8 | // To get around it, we can conditionally useEffect on the server (no-op) and
|
@@ -95,14 +96,14 @@ function useSelectorWithStoreAndSubscription(
|
95 | 96 | /**
|
96 | 97 | * Hook factory, which creates a `useSelector` hook bound to a given context.
|
97 | 98 | *
|
98 |
| - * @param {Function} [useReduxContext] Hook which returns the Redux context. |
| 99 | + * @param {Function} [context=ReactReduxContext] Context passed to your `<Provider>`. |
99 | 100 | * @returns {Function} A `useSelector` hook bound to the specified context.
|
100 | 101 | */
|
101 |
| -export function createSelectorHook(useReduxContext = useDefaultReduxContext) { |
| 102 | +export function createSelectorHook(context = ReactReduxContext) { |
102 | 103 | return function useSelector(selector, equalityFn = refEquality) {
|
103 | 104 | invariant(selector, `You must pass a selector to useSelectors`)
|
104 | 105 |
|
105 |
| - const { store, subscription: contextSub } = useReduxContext() |
| 106 | + const { store, subscription: contextSub } = useReduxContext(context) |
106 | 107 |
|
107 | 108 | return useSelectorWithStoreAndSubscription(
|
108 | 109 | selector,
|
|
0 commit comments