Applesauce
    Preparing search index...

    Function useObservableState

    • A hook that subscribes to an Observable and returns its current value.

      Unlike the standard useObservableState from observable-hooks, this hook will synchronously get the initial value if the Observable emits synchronously. This prevents an extra render when the Observable has an immediate value.

      If the Observable does not emit synchronously, the hook returns undefined for the initial render (unlike useObservableEagerState which throws).

      The synchronous render probe is closed immediately. The retained subscription is created by the effect so React Strict Mode cannot orphan render-phase work.

      Type Parameters

      • TState

        State type.

      Parameters

      Returns TState

      The current state value, or undefined if no value has been emitted yet.

    • A hook that subscribes to an Observable and returns its current value.

      Unlike the standard useObservableState from observable-hooks, this hook will synchronously get the initial value if the Observable emits synchronously. This prevents an extra render when the Observable has an immediate value.

      If the Observable does not emit synchronously, the hook returns undefined for the initial render (unlike useObservableEagerState which throws).

      The synchronous render probe is closed immediately. The retained subscription is created by the effect so React Strict Mode cannot orphan render-phase work.

      Type Parameters

      • TState

        State type.

      Parameters

      Returns TState | undefined

      The current state value, or undefined if no value has been emitted yet.