Reactive Utilities

useTransition

Edit this page
import { useTransition } from "solid-js"
function useTransition(): [
pending: () => boolean,
startTransition: (fn: () => void) => Promise<void>
]

Used to batch async updates in a transaction deferring commit until all async processes are complete. This is tied into Suspense and only tracks resources read under Suspense boundaries.

const [isPending, start] = useTransition();
// check if transitioning
isPending();
// wrap in transition
start(() => setSignal(newValue), () => /* transition is done */)
Report an issue with this page