Skip to content

Commit ff4773c

Browse files
committed
Use React wildcard imports in all files
1 parent 732a451 commit ff4773c

File tree

5 files changed

+12
-39
lines changed

5 files changed

+12
-39
lines changed

Diff for: src/alternate-renderers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
// Examples include React-Three-Fiber, Ink, etc.
44
// We'll assume they're built with React 18 and thus have `useSyncExternalStore` available.
55

6-
import { useSyncExternalStore } from 'react'
6+
import * as React from 'react'
77
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
88

99
import { initializeUseSelector } from './hooks/useSelector'
1010
import { initializeConnect } from './components/connect'
1111

1212
initializeUseSelector(useSyncExternalStoreWithSelector)
13-
initializeConnect(useSyncExternalStore)
13+
initializeConnect(React.useSyncExternalStore)
1414

1515
import { getBatch } from './utils/batch'
1616

Diff for: src/hooks/useReduxContext.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext } from 'react'
1+
import * as React from 'react'
22
import { ReactReduxContext } from '../components/Context'
33
import type { ReactReduxContextValue } from '../components/Context'
44

@@ -11,7 +11,7 @@ import type { ReactReduxContextValue } from '../components/Context'
1111
*/
1212
export function createReduxContextHook(context = ReactReduxContext) {
1313
return function useReduxContext(): ReactReduxContextValue | null {
14-
const contextValue = useContext(context)
14+
const contextValue = React.useContext(context)
1515

1616
if (process.env.NODE_ENV !== 'production' && !contextValue) {
1717
throw new Error(

Diff for: src/hooks/useSelector.ts

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import React, { useCallback, useDebugValue, useRef } from 'react'
1+
import * as React from 'react'
22

33
import {
44
createReduxContextHook,
55
useReduxContext as useDefaultReduxContext,
66
} from './useReduxContext'
7-
import {
8-
ReactReduxContext,
9-
ReactReduxContextValue,
10-
} from '../components/Context'
7+
import type { ReactReduxContextValue } from '../components/Context'
8+
import { ReactReduxContext } from '../components/Context'
119
import type { EqualityFn, NoInfer } from '../types'
1210
import type { uSESWS } from '../utils/useSyncExternalStore'
1311
import { notInitialized } from '../utils/useSyncExternalStore'
14-
import { Action, UnknownAction } from 'redux'
1512

1613
export type CheckFrequency = 'never' | 'once' | 'always'
1714

@@ -88,9 +85,9 @@ export function createSelectorHook(
8885
noopCheck: globalNoopCheck,
8986
} = useReduxContext()!
9087

91-
const firstRun = useRef(true)
88+
const firstRun = React.useRef(true)
9289

93-
const wrappedSelector = useCallback<typeof selector>(
90+
const wrappedSelector = React.useCallback<typeof selector>(
9491
{
9592
[selector.name](state: TState) {
9693
const selected = selector(state)
@@ -150,7 +147,7 @@ export function createSelectorHook(
150147
equalityFn
151148
)
152149

153-
useDebugValue(selectedState)
150+
React.useDebugValue(selectedState)
154151

155152
return selectedState
156153
}

Diff for: src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// The useSyncExternalStoreWithSelector has to be imported, but we can use the
44
// non-shim version. This shaves off the byte size of the shim.
55

6-
import { useSyncExternalStore } from 'react'
6+
import * as React from 'react'
77
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
88

99
import { unstable_batchedUpdates as batchInternal } from './utils/reactBatchedUpdates'
@@ -13,7 +13,7 @@ import { initializeUseSelector } from './hooks/useSelector'
1313
import { initializeConnect } from './components/connect'
1414

1515
initializeUseSelector(useSyncExternalStoreWithSelector)
16-
initializeConnect(useSyncExternalStore)
16+
initializeConnect(React.useSyncExternalStore)
1717

1818
// Enable batched updates in our subscriptions for use
1919
// with standard React renderers (ReactDOM, React Native)

Diff for: src/next.ts

-24
This file was deleted.

0 commit comments

Comments
 (0)