stepperize
Multi-step flows for React with typed ids, guards and results that explain why a navigation was refused.
const signup = defineStepper([
{ id: "account" },
{ id: "plan" },
{ id: "done" },
])
const stepper = signup.useStepper({
beforeStepChange: ({ from }) =>
from.id !== "account" ||
isEmail(email),
})
await stepper.next()
// { accepted: false,
// reason: "guard" }- 1Account
- 2Plan
- 3Done