State type.
An Observable of state values.
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 observable is only subscribed to once - the subscription created during the initial probe is kept alive and reused, avoiding issues with cold observables.
State type.
An Observable of state values.
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
useObservableStatefrom 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
undefinedfor the initial render (unlikeuseObservableEagerStatewhich throws).The observable is only subscribed to once - the subscription created during the initial probe is kept alive and reused, avoiding issues with cold observables.