API
useObservable
This hook subscribes to an observable and returns the value of the observable.
Imports
Definition
Source: useObservable
Parameters
observable
- Type:
Observable<T>
The observable to subscribe to.
config
- Type:
ObservableConfig.FromData<T>
- Optional
Configuration options for the observable.
config.fireImmediately
- Type:
boolean
- Optional
Trigger the update immediately, without waiting for the first update.
config.onError
- Type:
(error: Error) => void
- Optional
Callback function to be called when an error occurs.
config.onUpdate
- Type:
(data: Data) => void
- Optional
Callback function to be called when the data is updated.
Return Type
The value of the observable.
Was this page helpful?