mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
06f98c1680
This adds an initial implementation of useSyncExternalStore to the fiber reconciler. It's mostly a copy-paste of the userspace implementation, which is not ideal but is a good enough starting place. The main change we'll want to make to this native implementation is to move the tearing checks from the layout phase to an earlier, pre-commit phase so that code that runs in the commit phase always observes a consistent tree. Follow-ups: - Implement in Fizz - Implement in old SSR renderer - Implement in react-debug-hooks
use-sync-external-store
Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.
Until useSyncExternalStore is documented, refer to https://github.com/reactwg/react-18/discussions/86