Skip to main content

Installation

TanStack Store provides a core package and framework-specific adapters. Install the adapter for your framework to get started.
All TanStack Store packages require TypeScript 5.6+ for the best development experience.

Framework Adapters

Choose the adapter for your framework:

React

Install the React adapter which includes the core package:
npm install @tanstack/react-store

Requirements

  • React: 16.8+ (React 18+ recommended)
  • React DOM: 16.8+ (React 18+ recommended)
The React adapter is compatible with React 16.8+, 17, 18, and 19. It uses useSyncExternalStore for optimal concurrent rendering support.
TanStack Store for React is currently compatible with ReactDOM only. If you’d like to contribute a React Native adapter, please reach out on Discord.

Peer Dependencies

The following peer dependencies are required:
{
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}

Core Package Only

If you want to use TanStack Store without a framework (vanilla JavaScript/TypeScript) or build your own adapter, install just the core package:
npm install @tanstack/store
The core package has zero dependencies and can be used in any JavaScript environment.
import { createStore } from '@tanstack/store'

const store = createStore({ count: 0 })

store.setState((prev) => ({ count: prev.count + 1 }))
console.log(store.state.count) // 1

TypeScript Configuration

For the best TypeScript experience, ensure you’re using TypeScript 5.6 or later. TanStack Store is tested against TypeScript 5.6, 5.7, 5.8, and 5.9. No additional TypeScript configuration is required. All packages include full type definitions.

Verify Installation

After installation, verify everything works by creating a simple store:
import { Store } from '@tanstack/react-store'

const store = new Store({ count: 0 })
console.log('TanStack Store installed successfully!')

Next Steps

Now that you have TanStack Store installed, let’s build your first store:

Quickstart Guide

Learn how to create and use stores in your application