Skip to main content

Quickstart Guide

Get up and running with TanStack Store in minutes. This guide walks you through creating your first store and integrating it with your framework.

Your First Store

Let’s create a simple counter application to demonstrate the core concepts.
1

Install TanStack Store

First, install the appropriate package for your framework:
2

Create a Store

Create a store to manage your application state. Stores can be created inside or outside of components:
Stores can be instantiated outside of components and shared across your entire application.
3

Read Store State

Use the framework adapter’s hook/composable to read from the store. Only the specific data you select will trigger re-renders:
The selector function enables fine-grained subscriptions. Components only re-render when their selected data changes, not when any part of the store updates.
4

Update Store State

Update the store state using setState. Updates are immutable and trigger subscriptions:
5

Compose Your Application

Bring it all together in your application:

Core Concepts

Now that you’ve built your first store, let’s explore the key concepts:

Creating Stores

You can create stores with values or functions:

Derived Stores

Create stores that compute values from other stores:
You can access the previous computed value:

Subscriptions

Subscribe to store changes for side effects:

Batched Updates

Batch multiple updates to trigger subscribers only once:

Framework-Specific Examples

React Complete Example

Here’s the complete React example from the source code:

Vue Complete Example

Solid Complete Example

Next Steps

You’ve successfully created your first TanStack Store! Here’s what to explore next:

Core Concepts

Deep dive into stores, atoms, and reactivity

API Reference

Explore the complete API documentation

Framework Guides

Framework-specific patterns and best practices

Examples

Browse example applications and patterns