Skip to content

Commit

Permalink
docs: remove recently deleted props
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn committed Sep 3, 2023
1 parent 7980336 commit eea47f0
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 15 deletions.
7 changes: 6 additions & 1 deletion docs/framework/react/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export default function App() {
<form.Field
name="fullName"
children={(field) => (
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
)}
/>
</div>
Expand Down
41 changes: 34 additions & 7 deletions docs/guides/basic-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ Example:
name="firstName"
children={(field) => (
<>
<input {...field.getInputProps()} />
<input
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</>
)}
Expand All @@ -68,12 +72,16 @@ const { value, error, touched, isValidating } = field.state

## Field API

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.
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.

Example:

```tsx
<input {...field.getInputProps()} />
<input
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
```

## Validation
Expand All @@ -92,7 +100,11 @@ Example:
}}
children={(field) => (
<>
<input {...field.getInputProps()} />
<input
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</>
)}
Expand Down Expand Up @@ -143,7 +155,12 @@ Example:
return (
<div>
<label htmlFor={field.name}>Name:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<button
type="button"
onClick={() => hobbiesField.removeValue(i)}
Expand All @@ -162,7 +179,12 @@ Example:
return (
<div>
<label htmlFor={field.name}>Description:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</div>
)
Expand Down Expand Up @@ -202,7 +224,12 @@ Example:
return (
<div>
<label htmlFor={field.name}>Name:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<button type="button" onClick={() => hobbiesField.removeValue(i)}>
X
</button>
Expand Down
16 changes: 13 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function FieldInfo({ field }: { field: FieldApi<any, any> }) {
<>
{field.state.meta.touchedError ? (
<em>{field.state.meta.touchedError}</em>
) : null}{' '}
) : null}
{field.state.meta.isValidating ? 'Validating...' : null}
</>
)
Expand Down Expand Up @@ -93,7 +93,12 @@ export default function App() {
return (
<>
<label htmlFor={field.name}>First Name:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</>
)
Expand All @@ -106,7 +111,12 @@ export default function App() {
children={(field) => (
<>
<label htmlFor={field.name}>Last Name:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</>
)}
Expand Down
16 changes: 13 additions & 3 deletions examples/react/simple/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function FieldInfo({ field }: { field: FieldApi<any, any> }) {
<>
{field.state.meta.touchedError ? (
<em>{field.state.meta.touchedError}</em>
) : null}{" "}
) : null}
{field.state.meta.isValidating ? "Validating..." : null}
</>
);
Expand Down Expand Up @@ -65,7 +65,12 @@ export default function App() {
return (
<>
<label htmlFor={field.name}>First Name:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</>
);
Expand All @@ -78,7 +83,12 @@ export default function App() {
children={(field) => (
<>
<label htmlFor={field.name}>Last Name:</label>
<input name={field.name} {...field.getInputProps()} />
<input
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
/>
<FieldInfo field={field} />
</>
)}
Expand Down
3 changes: 2 additions & 1 deletion examples/react/simple/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"jsx": "react",
"noEmit": true
"noEmit": true,
"lib": ["DOM", "DOM.Iterable", "ES2020"]
},
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.js"]
}

0 comments on commit eea47f0

Please sign in to comment.