Type Alias: JourneyBundleBase<TMachine, TContext, TStepId, TSnapshot>
@rxova/journey-react / JourneyBundleBase
type JourneyBundleBase<TMachine, TContext, TStepId, TSnapshot> = object;Defined in: react/src/react.types.ts:114
The surface both bundles share: one standalone machine created by the
factory, the Provider/StepRenderer pair, and hooks that close over the
machine (so all of them work with or without the Provider — the Provider
exists to hand views to <StepRenderer>). The tiers differ only in their
verbs: linear adds navigate + useStepHandler, graph adds send.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
TMachine extends object |
TContext |
TStepId extends string |
TSnapshot extends object |
Properties
Section titled “Properties”controls
Section titled “controls”controls: TMachine["controls"];Defined in: react/src/react.types.ts:161
machine.controls, verbatim — callable from anywhere, React or not.
A plain property rather than a hook: it is the same frozen object on every
render, so a hook around it would only be a second spelling of
bundle.controls that happens to require a component to read it. The same
reasoning removed useMachine/useControls/useNavigation — reach the
machine through bundle.machine, and navigation through this tier’s own
navigate (linear) or send (graph).
machine
Section titled “machine”machine: TMachine;Defined in: react/src/react.types.ts:121
The bundle’s machine — created by the factory, usable outside React.
Provider
Section titled “Provider”Provider: (props) => React.ReactElement;Defined in: react/src/react.types.ts:122
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props | JourneyProviderProps<TStepId> |
Returns
Section titled “Returns”React.ReactElement
StepRenderer
Section titled “StepRenderer”StepRenderer: (props) => React.ReactElement;Defined in: react/src/react.types.ts:124
Renders the active step’s view; place it anywhere inside the Provider.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props | JourneyStepRendererProps |
Returns
Section titled “Returns”React.ReactElement
updateContext
Section titled “updateContext”updateContext: (updater) => void;Defined in: react/src/react.types.ts:164
machine.context.update, verbatim — callable from anywhere, React or not.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
updater | (context) => TContext |
Returns
Section titled “Returns”void
useContextSelector
Section titled “useContextSelector”useContextSelector: <TSelected>(selector, equalityFn?) => TSelected;Defined in: react/src/react.types.ts:141
A derived slice of the machine’s context; re-renders only when it changes
(reactive). The selector is required — useContextSelector((c) => c) is
the explicit way to ask for the whole object, and re-renders on every
context write by construction rather than by accident.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
TSelected |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
selector | (context) => TSelected |
equalityFn? | (a, b) => boolean |
Returns
Section titled “Returns”TSelected
useEventEffect
Section titled “useEventEffect”useEventEffect: <TEvent>(event, listener) => void;Defined in: react/src/react.types.ts:146
Subscribes a listener to a machine event for the component’s lifetime.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
TEvent extends JourneySubscriptionEvent |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | TEvent |
listener | (payload) => void |
Returns
Section titled “Returns”void
useSelector
Section titled “useSelector”useSelector: <TSelected>(selector, equalityFn?) => TSelected;Defined in: react/src/react.types.ts:129
A derived slice of the snapshot; re-renders only when it changes (reactive).
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
TSelected |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
selector | (snapshot) => TSelected |
equalityFn? | (a, b) => boolean |
Returns
Section titled “Returns”TSelected
useSnapshot
Section titled “useSnapshot”useSnapshot: () => TSnapshot;Defined in: react/src/react.types.ts:127
The machine’s live snapshot (reactive).
Returns
Section titled “Returns”TSnapshot
useStep
Section titled “useStep”useStep: () => TSnapshot["currentStep"];Defined in: react/src/react.types.ts:134
The current step — id, metadata, async state — or null while idle (reactive).
Returns
Section titled “Returns”TSnapshot["currentStep"]