Skip to main content

suspended()

The pipeable version of suspend. Prepends a SUSPENSE to the source Observable.

function suspended<T>(): OperatorFunction<T, T | typeof SUSPEND>

Returns

OperatorFunction<T, T | typeof SUSPEND>: An Observable that emits SUSPENSE as its first value, followed by the values from the source Observable.

Example

import { switchMap } from 'rxjs/operators'
import { suspended } from '@react-rxjs/utils'

const story$ = selectedStoryId$.pipe(
switchMap((id) => getStory$(id).pipe(suspended())),
)

See also