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

    Function useOptionalBoundSyncExternalStore

    • Like useBoundSyncExternalStore, but for a store that may be absent (null/undefined) — the bound-method analog of useOptionalSyncExternalStore. 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 them (which would strip this); returns the snapshot, or null when there is no store.

      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 | null | undefined
      • getSnapshot: (store: S) => T

      Returns T | null

      Pass the store instance (or null/undefined) and a selector that reads the snapshot off it (s => s.getState()). subscribe is memoized on the store identity so it stays a stable reference across renders; the snapshot selector may be an inline arrow. The null snapshot doubles as the SSR snapshot, keeping it SSR-safe.