Skip to content

Commit c85a9ee

Browse files
committed
remove builtInAPI Check in useSyncExternalStoreClient
1 parent 5fce187 commit c85a9ee

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

packages/use-sync-external-store/src/useSyncExternalStoreClient.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,7 @@ import is from 'shared/objectIs';
1212

1313
// Intentionally not using named imports because Rollup uses dynamic
1414
// dispatch for CommonJS interop named imports.
15-
const {
16-
useState,
17-
useEffect,
18-
useLayoutEffect,
19-
useDebugValue,
20-
// The built-in API is still prefixed.
21-
unstable_useSyncExternalStore: builtInAPI,
22-
} = React;
23-
24-
// Prefer the built-in API, if it exists. If it doesn't exist, then we assume
25-
// we're in version 16 or 17, so rendering is always synchronous. The shim
26-
// does not support concurrent rendering, only the built-in API.
27-
export const useSyncExternalStore =
28-
builtInAPI !== undefined
29-
? ((builtInAPI: any): typeof useSyncExternalStore_client)
30-
: useSyncExternalStore_client;
15+
const {useState, useEffect, useLayoutEffect, useDebugValue} = React;
3116

3217
let didWarnOld18Alpha = false;
3318
let didWarnUncachedGetSnapshot = false;
@@ -42,7 +27,7 @@ let didWarnUncachedGetSnapshot = false;
4227
//
4328
// Do not assume that the clever hacks used by this hook also work in general.
4429
// The point of this shim is to replace the need for hacks by other libraries.
45-
function useSyncExternalStore_client<T>(
30+
export function useSyncExternalStore<T>(
4631
subscribe: (() => void) => () => void,
4732
getSnapshot: () => T,
4833
// Note: The client shim does not use getServerSnapshot, because pre-18

0 commit comments

Comments
 (0)