You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page is a collection of community-created tutorials, articles, and videos that can help you learn more about TanStack Form from other developers. If you created a resource that you would like to add to this list, please open a PR! We keep them in chronological order by publish date to ensure the most up to date content is at the top.
7
+
8
+
> Please note that the content listed here is entirely community maintained. While it may not be fully aligned with official recommendations and best practices, it can still offer valuable insights and alternative perspectives.
9
+
10
+
## TanStack Form Tutorial - Best Form Library for React?
A tutorial from [Atharva Deosthale](https://links.atharva.codes) using TanStack Form in a Next.js project. The video is made for people who are just getting started with knowing TanStack Form and will cover client-side form validation and server-side form validation by taking advantage of the Form SDK. This tutorial expects you to have basic knowledge of working of React and client-server architectures.
Copy file name to clipboardExpand all lines: docs/framework/react/guides/basic-concepts.md
+27-4
Original file line number
Diff line number
Diff line change
@@ -92,17 +92,40 @@ const {
92
92
} =field.state
93
93
```
94
94
95
-
There are three field states that can be useful to see how the user interacts with a field: A field is _"touched"_ when the user clicks/tabs into it, _"pristine"_ until the user changes value in it, and _"dirty"_ after the value has been changed. You can check these states via the `isTouched`, `isPristine` and `isDirty` flags, as seen below.
95
+
There are three states in the metadata that can be useful to see how the user interacts with a field:
96
+
97
+
-_"isTouched"_, after the user clicks/tabs into the field
98
+
-_"isPristine"_, until the user changes the field value
99
+
-_"isDirty"_, after the fields value has been changed
> **Important note for users coming from `React Hook Form`**: the `isDirty` flag in `TanStack/form` is different from the flag with the same name in RHF.
104
-
> In RHF, `isDirty = true`, when the form's values are different from the original values. If the user changes the values in a form, and then changes them again to end up with values that match the form's default values, `isDirty` will be `false` in RHF, but `true` in `TanStack/form`.
105
-
> The default values are exposed both on the form's and the field's level in `TanStack/form` (`form.options.defaultValues`, `field.options.defaultValue`), so you can write your own `isDefaultValue()` helper if you need to emulate RHF's behavior.`
107
+
## Understanding 'isDirty' in Different Libraries
108
+
109
+
Non-Persistent `dirty` state
110
+
111
+
-**Libraries**: React Hook Form (RHF), Formik, Final Form.
112
+
-**Behavior**: A field is 'dirty' if its value differs from the default. Reverting to the default value makes it 'clean' again.
113
+
114
+
Persistent `dirty` state
115
+
116
+
-**Libraries**: Angular Form, Vue FormKit.
117
+
-**Behavior**: A field remains 'dirty' once changed, even if reverted to the default value.
118
+
119
+
We have chosen the persistent 'dirty' state model. To also support a non-persistent 'dirty' state, we introduce the isDefault flag. This flag acts as an inverse of the non-persistent 'dirty' state.
0 commit comments