[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.
This commit is contained in:
Andrew Clark
2021-09-13 21:55:18 -07:00
committed by GitHub
parent fd5e01c2e0
commit 806aaa2e21
2 changed files with 4 additions and 1 deletions
@@ -46,6 +46,8 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
startTransition: _,
// eslint-disable-next-line no-unused-vars
useSyncExternalStore: __,
// eslint-disable-next-line no-unused-vars
unstable_useSyncExternalStore: ___,
...otherExports
} = jest.requireActual('react');
return otherExports;
@@ -17,7 +17,8 @@ const {
useEffect,
useLayoutEffect,
useDebugValue,
useSyncExternalStore: builtInAPI,
// The built-in API is still prefixed.
unstable_useSyncExternalStore: builtInAPI,
} = React;
// Prefer the built-in API, if it exists. If it doesn't exist, then we assume