Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

SubscribeProps.md

84 lines1.6 KB

1---
2id: SubscribeProps
3title: SubscribeProps
4---
5​
6Defined in: [packages/react-form/src/Subscribe.public.tsx:17](https://github.com/TanStack/form/blob/main/packages/react-form/src/Subscribe.public.tsx#L17)
7​
8Subscribe to `form.atom` (full form state). The selector receives the full
9FormState.
10​
11## Type Parameters
12​
13### TSourceData
14​
15`TSourceData`
16​
17### TSelected
18​
19`TSelected`
20​
21## Properties
22​
23### children
24​
25```ts
26children: ReactNode | ((state) => ReactNode);
27```
28​
29Defined in: [packages/react-form/src/Subscribe.public.tsx:28](https://github.com/TanStack/form/blob/main/packages/react-form/src/Subscribe.public.tsx#L28)
30​
31***
32​
33### selector
34​
35```ts
36selector: (state) => TSelected;
37```
38​
39Defined in: [packages/react-form/src/Subscribe.public.tsx:23](https://github.com/TanStack/form/blob/main/packages/react-form/src/Subscribe.public.tsx#L23)
40​
41Select from full form state. Re-renders when the selected value changes
42(shallow compare).
43​
44#### Parameters
45​
46##### state
47​
48`TSourceData`
49​
50#### Returns
51​
52`TSelected`
53​
54***
55​
56### source
57​
58```ts
59source: SubscribeSource<TSourceData>;
60```
61​
62Defined in: [packages/react-form/src/Subscribe.public.tsx:18](https://github.com/TanStack/form/blob/main/packages/react-form/src/Subscribe.public.tsx#L18)
63​
64***
65​
66### when?
67​
68```ts
69optional when?: (selected) => boolean;
70```
71​
72Defined in: [packages/react-form/src/Subscribe.public.tsx:27](https://github.com/TanStack/form/blob/main/packages/react-form/src/Subscribe.public.tsx#L27)
73​
74Optional. If provided, the component will only render when the `when` function returns `true`.
75​
76#### Parameters
77​
78##### selected
79​
80`NoInfer`\<`TSelected`\>
81​
82#### Returns
83​
84`boolean`