Rxova
Skip to content

Type Alias: JourneyBundleBase<TMachine, TContext, TStepId, TSnapshot>

@rxova/journey-react


@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 Parameter
TMachine extends object
TContext
TStepId extends string
TSnapshot extends object
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: TMachine;

Defined in: react/src/react.types.ts:121

The bundle’s machine — created by the factory, usable outside React.


Provider: (props) => React.ReactElement;

Defined in: react/src/react.types.ts:122

ParameterType
propsJourneyProviderProps<TStepId>

React.ReactElement


StepRenderer: (props) => React.ReactElement;

Defined in: react/src/react.types.ts:124

Renders the active step’s view; place it anywhere inside the Provider.

ParameterType
propsJourneyStepRendererProps

React.ReactElement


updateContext: (updater) => void;

Defined in: react/src/react.types.ts:164

machine.context.update, verbatim — callable from anywhere, React or not.

ParameterType
updater(context) => TContext

void


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 Parameter
TSelected
ParameterType
selector(context) => TSelected
equalityFn?(a, b) => boolean

TSelected


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 Parameter
TEvent extends JourneySubscriptionEvent
ParameterType
eventTEvent
listener(payload) => void

void


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 Parameter
TSelected
ParameterType
selector(snapshot) => TSelected
equalityFn?(a, b) => boolean

TSelected


useSnapshot: () => TSnapshot;

Defined in: react/src/react.types.ts:127

The machine’s live snapshot (reactive).

TSnapshot


useStep: () => TSnapshot["currentStep"];

Defined in: react/src/react.types.ts:134

The current step — id, metadata, async state — or null while idle (reactive).

TSnapshot["currentStep"]