Overview
This guide helps you migrate between major versions of TanStack Store and understand breaking changes. TanStack Store follows semantic versioning, so major version bumps indicate breaking changes.Migrating to v0.9.x
Breaking Changes in v0.9.0
Version 0.9.0 introduced significant API changes to improve ergonomics and leverage a new reactive core based on alien-signals.Class Constructors → Factory Functions
The biggest change is moving from class constructors to factory functions:Derived Stores
TheDerived class has been replaced with computed createStore() calls:
Effects → Subscriptions
TheEffect class has been removed in favor of the subscribe() method:
Type Changes
Import types from the main package:Observable Interop
The subscription API now follows the Observable spec more closely:Step-by-Step Migration
1
Update Dependencies
Update your package.json to the latest version:
2
Replace Store Constructor Calls
Find and replace all
new Store() with createStore():3
Replace Derived Stores
Replace
new Derived() with derived createStore():4
Replace Effects with Subscriptions
Replace
new Effect() with store.subscribe():5
Update Type Imports
Update your type imports:
6
Test Your Application
Run your test suite to ensure everything works:
Migrating from Other State Libraries
From Redux
TanStack Store can replace Redux with less boilerplate:From Zustand
TanStack Store has a similar API to Zustand:From Jotai
TanStack Store’s atoms work similarly to Jotai:From MobX
TanStack Store provides similar reactivity with less boilerplate:Common Migration Issues
Issue: Cannot call setState on readonly store
Issue: Subscriptions fire immediately
Subscriptions fire once immediately on creation (this is intentional):Issue: Type errors with generic stores
Framework-Specific Migration
React
Vue
Svelte
Version History
v0.9.1 (Latest)
- Fix: Derived
createStorenow returns readonly store (#278)
v0.9.0
- Breaking:
new Store()→createStore()(#265) - Breaking:
new Derived()→ derivedcreateStore() - Breaking:
new Effect()→store.subscribe() - New: Uses alien-signals for efficient reactivity
v0.8.1
- Fix: Issues with Derived Fields not Retriggering (#274)
Getting Help
If you encounter migration issues:GitHub Discussions
Ask questions and get help from the community
GitHub Issues
Report bugs or migration problems
Discord
Join the TanStack Discord for real-time help
Follow @tanstack for updates
Next Steps
- Review Type Safety for TypeScript best practices
- Learn about Performance optimization
- Explore Async Atoms for async data