Skip to content

Commit 806aaa2

Browse files
authored
[useSES shim] Import prefixed native API (#22310)
Until useSyncExternalStore is finalized, the shim should import the prefixed version (unstable_useSyncExternalStore), which is available in the experimental builds. That way our early testers can start using it.
1 parent fd5e01c commit 806aaa2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
4646
startTransition: _,
4747
// eslint-disable-next-line no-unused-vars
4848
useSyncExternalStore: __,
49+
// eslint-disable-next-line no-unused-vars
50+
unstable_useSyncExternalStore: ___,
4951
...otherExports
5052
} = jest.requireActual('react');
5153
return otherExports;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const {
1717
useEffect,
1818
useLayoutEffect,
1919
useDebugValue,
20-
useSyncExternalStore: builtInAPI,
20+
// The built-in API is still prefixed.
21+
unstable_useSyncExternalStore: builtInAPI,
2122
} = React;
2223

2324
// Prefer the built-in API, if it exists. If it doesn't exist, then we assume

0 commit comments

Comments
 (0)