Skip to main content

SUSPENSE

SUSPENSE is a special symbol that can be emitted from observables to let the React hook know that there is a value on its way, and that we want to leverage React Suspense while we are waiting for that value.

const SUSPENSE: unique symbol

Example

import { concat, of } from "rxjs"
import { switchMap } from "rxjs/operators"
import { SUSPENSE } from "@react-rxjs/core"

const story$ = selectedStoryId$.pipe(
switchMap((id) => concat(of(SUSPENSE), getStory$(id))),
)

See also