dillon1000/react
Commit
Browse files Initial shim of useSyncExternalStore (#22211)
This sets up an initial shim implementation of useSyncExternalStore, via the use-sync-external-store package. It's designed to mimic the behavior of the built-in API, but is backwards compatible to any version of React that supports hooks. I have not yet implemented the built-in API, but once it exists, the use-sync-external-store package will always prefer that one. Library authors can depend on the shim and trust that their users get the correct implementation. See https://github.com/reactwg/react-18/discussions/86 for background on the API. The tests I've added here are designed to run against both the shim and built-in implementation, using our variant test flag feature. Tests that only apply to concurrent roots will live in a separate suite.
Changed paths7 files
First-parent comparisonpackages/use-sync-external-store/extra.js RenamedA packages/use-sync-external-store/npm/extra.js AddedM packages/use-sync-external-store/package.json ModifiedA packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js AddedM packages/use-sync-external-store/src/useSyncExternalStore.js ModifiedA packages/use-sync-external-store/src/useSyncExternalStoreExtra.js AddedM scripts/rollup/bundles.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…