React Examples
Use this page as a guide to common React integration scenarios.
React examples focus on wiring and component patterns. For runtime internals, pair them with Core docs.
Example Scenarios
Section titled “Example Scenarios”1. Basic createJourney Setup
Section titled “1. Basic createJourney Setup”What it shows:
createJourney(definition, options?)- separate
views JourneyProviderStepRenderer
Start from: /docs/react/quickstart
2. Provider-Free Hooks
Section titled “2. Provider-Free Hooks”What it shows:
useJourneySnapshot()useJourneyApi()useJourneySelector()useJourneyEvent()
Use this when components need machine state or actions but are not part of step rendering.
3. Controlled Navigation
Section titled “3. Controlled Navigation”What it shows:
goToNextStepgoToPreviousStepgoToLastVisitedStep- explicit event sending via
api.send(...)
Runtime semantics live in: /docs/core/api and /docs/core/history
4. Async UI
Section titled “4. Async UI”What it shows:
- reading
snapshot.async - loading and error rendering
clearStepError
Runtime async rules live in: /docs/core/async
5. Step Metadata Reads
Section titled “5. Step Metadata Reads”What it shows:
getStepMeta(stepId)from React actions or selectors
Step metadata semantics live in: /docs/core/api
6. Devtools Bridge Integration
Section titled “6. Devtools Bridge Integration”What it shows:
- passing
journey.machinetoattachJourneyDevtools(...)
7. Inside-Component Journey Creation
Section titled “7. Inside-Component Journey Creation”What it shows:
useMemo(() => createJourney(...), [])disposeOnUnmountfor provider-owned cleanup
Full Integration Reference
Section titled “Full Integration Reference”For an end-to-end setup across core, react, and the devtools bridge, see the demo app in this repository.