Skip to main content

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.
Major API ChangesVersion 0.9.0 is a major rewrite with breaking changes. Review this section carefully before upgrading.

Class Constructors → Factory Functions

The biggest change is moving from class constructors to factory functions:

Derived Stores

The Derived class has been replaced with computed createStore() calls:
The new API is simpler: if you pass a function to createStore, it creates a derived (readonly) store. If you pass a value, it creates a mutable store.

Effects → Subscriptions

The Effect 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

Solution: Derived stores (created with a function) are readonly. Update the source store instead:

Issue: Subscriptions fire immediately

Subscriptions fire once immediately on creation (this is intentional):
Solution: Handle the initial call if needed:

Issue: Type errors with generic stores

Solution: Use union types for nullable values:

Framework-Specific Migration

React

Vue

Svelte

Version History

v0.9.1 (Latest)

  • Fix: Derived createStore now returns readonly store (#278)

v0.9.0

  • Breaking: new Store()createStore() (#265)
  • Breaking: new Derived() → derived createStore()
  • 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

Twitter

Follow @tanstack for updates

Next Steps