Open History to see the last commit
1---
2id: ReadonlyAtom
3title: ReadonlyAtom
4---
5β
6Defined in: node\_modules/.pnpm/@tanstack+store@0.11.0/node\_modules/@tanstack/store/dist/types.d.ts:49
7β
8An atom that is read-only and cannot be set.
9β
10## Example
11β
12```ts
13const atom = createAtom(() => 42);
14// @ts-expect-error - Cannot set a readonly atom
15atom.set(43);
16```
17β
18## Extends
19β
20- [`BaseAtom`](BaseAtom.md)\<`T`\>
21β
22## Type Parameters
23β
24### T
25β
26`T`
27β
28## Properties
29β
30### get
31β
32```ts
33get: () => T;
34```
35β
36Defined in: node\_modules/.pnpm/@tanstack+store@0.11.0/node\_modules/@tanstack/store/dist/types.d.ts:20
37β
38#### Returns
39β
40`T`
41β
42#### Inherited from
43β
44[`BaseAtom`](BaseAtom.md).[`get`](BaseAtom.md#get)
45β
46***
47β
48### subscribe
49β
50```ts
51subscribe: (observer) => Subscription & (next, error?, complete?) => Subscription;
52```
53β
54Defined in: node\_modules/.pnpm/@tanstack+store@0.11.0/node\_modules/@tanstack/store/dist/types.d.ts:17
55β
56#### Inherited from
57β
58[`BaseAtom`](BaseAtom.md).[`subscribe`](BaseAtom.md#subscribe)