Skip to content

Commit eea47f0

Browse files
committed
docs: remove recently deleted props
1 parent 7980336 commit eea47f0

File tree

5 files changed

+68
-15
lines changed

5 files changed

+68
-15
lines changed

docs/framework/react/quick-start.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ export default function App() {
3232
<form.Field
3333
name="fullName"
3434
children={(field) => (
35-
<input name={field.name} {...field.getInputProps()} />
35+
<input
36+
name={field.name}
37+
value={field.state.value}
38+
onBlur={field.handleBlur}
39+
onChange={(e) => field.handleChange(e.target.value)}
40+
/>
3641
)}
3742
/>
3843
</div>

docs/guides/basic-concepts.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ Example:
4949
name="firstName"
5050
children={(field) => (
5151
<>
52-
<input {...field.getInputProps()} />
52+
<input
53+
value={field.state.value}
54+
onBlur={field.handleBlur}
55+
onChange={(e) => field.handleChange(e.target.value)}
56+
/>
5357
<FieldInfo field={field} />
5458
</>
5559
)}
@@ -68,12 +72,16 @@ const { value, error, touched, isValidating } = field.state
6872

6973
## Field API
7074

71-
The Field API is an object passed to the render prop function when creating a field. It provides methods for working with the field's state, such as getInputProps, which returns an object with props needed to bind the field to a form input element.
75+
The Field API is an object passed to the render prop function when creating a field. It provides methods for working with the field's state.
7276

7377
Example:
7478

7579
```tsx
76-
<input {...field.getInputProps()} />
80+
<input
81+
value={field.state.value}
82+
onBlur={field.handleBlur}
83+
onChange={(e) => field.handleChange(e.target.value)}
84+
/>
7785
```
7886

7987
## Validation
@@ -92,7 +100,11 @@ Example:
92100
}}
93101
children={(field) => (
94102
<>
95-
<input {...field.getInputProps()} />
103+
<input
104+
value={field.state.value}
105+
onBlur={field.handleBlur}
106+
onChange={(e) => field.handleChange(e.target.value)}
107+
/>
96108
<FieldInfo field={field} />
97109
</>
98110
)}
@@ -143,7 +155,12 @@ Example:
143155
return (
144156
<div>
145157
<label htmlFor={field.name}>Name:</label>
146-
<input name={field.name} {...field.getInputProps()} />
158+
<input
159+
name={field.name}
160+
value={field.state.value}
161+
onBlur={field.handleBlur}
162+
onChange={(e) => field.handleChange(e.target.value)}
163+
/>
147164
<button
148165
type="button"
149166
onClick={() => hobbiesField.removeValue(i)}
@@ -162,7 +179,12 @@ Example:
162179
return (
163180
<div>
164181
<label htmlFor={field.name}>Description:</label>
165-
<input name={field.name} {...field.getInputProps()} />
182+
<input
183+
name={field.name}
184+
value={field.state.value}
185+
onBlur={field.handleBlur}
186+
onChange={(e) => field.handleChange(e.target.value)}
187+
/>
166188
<FieldInfo field={field} />
167189
</div>
168190
)
@@ -202,7 +224,12 @@ Example:
202224
return (
203225
<div>
204226
<label htmlFor={field.name}>Name:</label>
205-
<input name={field.name} {...field.getInputProps()} />
227+
<input
228+
name={field.name}
229+
value={field.state.value}
230+
onBlur={field.handleBlur}
231+
onChange={(e) => field.handleChange(e.target.value)}
232+
/>
206233
<button type="button" onClick={() => hobbiesField.removeValue(i)}>
207234
X
208235
</button>

docs/overview.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function FieldInfo({ field }: { field: FieldApi<any, any> }) {
3636
<>
3737
{field.state.meta.touchedError ? (
3838
<em>{field.state.meta.touchedError}</em>
39-
) : null}{' '}
39+
) : null}
4040
{field.state.meta.isValidating ? 'Validating...' : null}
4141
</>
4242
)
@@ -93,7 +93,12 @@ export default function App() {
9393
return (
9494
<>
9595
<label htmlFor={field.name}>First Name:</label>
96-
<input name={field.name} {...field.getInputProps()} />
96+
<input
97+
name={field.name}
98+
value={field.state.value}
99+
onBlur={field.handleBlur}
100+
onChange={(e) => field.handleChange(e.target.value)}
101+
/>
97102
<FieldInfo field={field} />
98103
</>
99104
)
@@ -106,7 +111,12 @@ export default function App() {
106111
children={(field) => (
107112
<>
108113
<label htmlFor={field.name}>Last Name:</label>
109-
<input name={field.name} {...field.getInputProps()} />
114+
<input
115+
name={field.name}
116+
value={field.state.value}
117+
onBlur={field.handleBlur}
118+
onChange={(e) => field.handleChange(e.target.value)}
119+
/>
110120
<FieldInfo field={field} />
111121
</>
112122
)}

examples/react/simple/src/index.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function FieldInfo({ field }: { field: FieldApi<any, any> }) {
88
<>
99
{field.state.meta.touchedError ? (
1010
<em>{field.state.meta.touchedError}</em>
11-
) : null}{" "}
11+
) : null}
1212
{field.state.meta.isValidating ? "Validating..." : null}
1313
</>
1414
);
@@ -65,7 +65,12 @@ export default function App() {
6565
return (
6666
<>
6767
<label htmlFor={field.name}>First Name:</label>
68-
<input name={field.name} {...field.getInputProps()} />
68+
<input
69+
name={field.name}
70+
value={field.state.value}
71+
onBlur={field.handleBlur}
72+
onChange={(e) => field.handleChange(e.target.value)}
73+
/>
6974
<FieldInfo field={field} />
7075
</>
7176
);
@@ -78,7 +83,12 @@ export default function App() {
7883
children={(field) => (
7984
<>
8085
<label htmlFor={field.name}>Last Name:</label>
81-
<input name={field.name} {...field.getInputProps()} />
86+
<input
87+
name={field.name}
88+
value={field.state.value}
89+
onBlur={field.handleBlur}
90+
onChange={(e) => field.handleChange(e.target.value)}
91+
/>
8292
<FieldInfo field={field} />
8393
</>
8494
)}

examples/react/simple/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "../../../tsconfig.json",
33
"compilerOptions": {
44
"jsx": "react",
5-
"noEmit": true
5+
"noEmit": true,
6+
"lib": ["DOM", "DOM.Iterable", "ES2020"]
67
},
78
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.js"]
89
}

0 commit comments

Comments
 (0)