Reactive utilities

useTransition

Edit this page

Replacement

// 1.x
import { useTransition } from "solid-js"
const [isPending, start] = useTransition()
start(() => setSignal(newValue))
// 2.0 — just update the signal
setSignal(newValue)
// For pending state:
import { isPending } from "solid-js"
const pending = () => isPending(() => asyncMemo())
  • Use <Loading> boundaries for initial loading UI
  • Use isPending() for stale-while-revalidating indicators
  • Use action() for mutations with optimistic UI

See the fetching data guide for complete patterns.

Report an issue with this page