SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Function useBoundSyncExternalStore

    • Like useSyncExternalStore, but for a store exposed as an object with methods rather than standalone functions. It calls store.subscribe(...) and the snapshot selector on the instance, so a normal this-centric class — whose methods are NOT pre-bound — works without the caller detaching its methods (which would strip this). The model stays a plain class; the one adaptation into useSyncExternalStore's function-value contract lives here.

      Type Parameters

      • S extends { subscribe(onStoreChange: () => void): () => void }

        The store type; must expose a subscribe(listener) method.

      • T

        The snapshot value type.

      Parameters

      • store: S
      • getSnapshot: (store: S) => T

      Returns T

      Pass the store instance and a selector that reads the snapshot off it (s => s.getSelection()). subscribe is memoized on the store identity so it stays a stable reference across renders (a changed subscribe would resubscribe); the snapshot selector may be an inline arrow. The selector doubles as the SSR snapshot.

      Contrast useOptionalSyncExternalStore, which takes pre-bound standalone functions and tolerates an absent (null) store.