Framework Integrations
Choose immutable, mutable, official-binding, or externally owned history for your state architecture.
Travels’ core does not depend on a UI framework. The right integration depends on who owns state and whether your reactive system expects a new reference or stable object identity.
Choose an integration
| Framework or owner | Recommended starting point | History mode |
|---|---|---|
| React | useSyncExternalStore or use-travel@3 | Immutable |
| Vue composable | shallowRef/ref subscription | Immutable |
| Vue reactive store / Pinia | Pass the observed object directly | mutable: true |
| Zustand | zustand-travel@3 or manual external-store sync | Immutable / binding-owned |
| MobX | Pass observable state directly | mutable: true |
| Form manager | Detached values with manual archive, or an external journal | Depends on owner |
| State machine / existing patch producer | createTravelJournal() | Externally owned |
React
External-store subscriptions, controls, and component ownership.
Vue
Immutable composables and reference-stable reactive state.
Zustand
Official middleware and direct core integration.
MobX and Pinia
Mutable timelines for identity-sensitive stores.
Forms and External Stores
Single-owner synchronization and delegated navigation.
Official v3 bindings
use-travelprovides React hooks and shared-store integration.zustand-travelprovides Zustand middleware.
Use travels@^3.0.1 with either v3 binding: use-travel@3 accepts travels@^3.0.0, and zustand-travel@3 requires travels@^3.0.1. Both bindings support mutative@^2.0.0. Use matching majors so factory overloads, read-only views, and snapshot restoration share one contract.
Integration invariants
Regardless of framework:
- Create one timeline per logical document or editing session.
- Keep its identity stable for as long as subscribers depend on it.
- Update through exactly one authoritative state path.
- Re-render on timeline revision as well as state changes.
- Unsubscribe when the owner is disposed.
- Flush pending persistence before controlled shutdown points.
Runnable source examples are linked from Examples.