Open History to see the last commit
1---
2id: Store
3title: Store
4---
5β
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7β
8# Class: Store\<TState, TUpdater\>
9β
10Defined in: [store.ts:27](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L27)
11β
12## Type Parameters
13β
14β’ **TState**
15β
16β’ **TUpdater** *extends* `AnyUpdater` = (`cb`) => `TState`
17β
18## Constructors
19β
20### new Store()
21β
22```ts
23new Store<TState, TUpdater>(initialState, options?): Store<TState, TUpdater>
24```
25β
26Defined in: [store.ts:36](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L36)
27β
28#### Parameters
29β
30##### initialState
31β
32`TState`
33β
34##### options?
35β
36[`StoreOptions`](../../interfaces/storeoptions.md)\<`TState`, `TUpdater`\>
37β
38#### Returns
39β
40[`Store`](../store.md)\<`TState`, `TUpdater`\>
41β
42## Properties
43β
44### listeners
45β
46```ts
47listeners: Set<Listener<TState>>;
48```
49β
50Defined in: [store.ts:31](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L31)
51β
52***
53β
54### options?
55β
56```ts
57optional options: StoreOptions<TState, TUpdater>;
58```
59β
60Defined in: [store.ts:34](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L34)
61β
62***
63β
64### prevState
65β
66```ts
67prevState: TState;
68```
69β
70Defined in: [store.ts:33](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L33)
71β
72***
73β
74### state
75β
76```ts
77state: TState;
78```
79β
80Defined in: [store.ts:32](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L32)
81β
82## Methods
83β
84### setState()
85β
86```ts
87setState(updater): void
88```
89β
90Defined in: [store.ts:51](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L51)
91β
92#### Parameters
93β
94##### updater
95β
96`TUpdater`
97β
98#### Returns
99β
100`void`
101β
102***
103β
104### subscribe()
105β
106```ts
107subscribe(listener): () => void
108```
109β
110Defined in: [store.ts:42](https://github.com/TanStack/store/blob/main/packages/store/src/store.ts#L42)
111β
112#### Parameters
113β
114##### listener
115β
116`Listener`\<`TState`\>
117β
118#### Returns
119β
120`Function`
121β
122##### Returns
123β
124`void`