File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 1
- // The default entry point assumes we are working with React 18, and thus have
2
- // useSyncExternalStore available. We can import that directly from React itself.
3
- // The useSyncExternalStoreWithSelector has to be imported, but we can use the
4
- // non-shim version. This shaves off the byte size of the shim.
1
+ // The primary entry point assumes we're working with standard ReactDOM/RN, but
2
+ // older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x).
3
+ // Because of that, the useSyncExternalStore compat shim is needed.
5
4
6
- // @ts -ignore React types not updated yet
7
- import { useSyncExternalStore } from 'react'
8
- import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
5
+ import { useSyncExternalStore } from 'use-sync-external-store/shim'
6
+ import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'
9
7
10
8
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'
11
9
import { setBatch } from './utils/batch'
Original file line number Diff line number Diff line change 1
- // The "compat" entry point assumes we're working with standard ReactDOM/RN, but
2
- // older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x).
3
- // Because of that, the useSyncExternalStore compat shim is needed.
1
+ // The secondary entry point assumes we are working with React 18, and thus have
2
+ // useSyncExternalStore available. We can import that directly from React itself.
3
+ // The useSyncExternalStoreWithSelector has to be imported, but we can use the
4
+ // non-shim version. This shaves off the byte size of the shim.
4
5
5
- import { useSyncExternalStore } from 'use-sync-external-store/shim '
6
- import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/ with-selector'
6
+ import { useSyncExternalStore } from 'react '
7
+ import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
7
8
8
9
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'
9
10
import { setBatch } from './utils/batch'
You can’t perform that action at this time.
0 commit comments