Skip to content

Commit

Permalink
Correcting Form Validation Error Handling (#7707)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarbutt authored Oct 19, 2023
1 parent e906aa6 commit 33dc6a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,3 +595,4 @@
- TrySound
- rogepi
- fredericoo
- jmarbutt
8 changes: 4 additions & 4 deletions docs/guides/form-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ import {
} from "@remix-run/react";

export default function Signup() {
const { errors } = useActionData<typeof useAction>();
const actionData = useActionData<typeof action>();

return (
<Form method="post">
<p>
<input type="email" name="email" />
{errors?.email ? <em>{errors.email}</em> : null}
{actionData?.errors?.email ? <em>{actionData?.errors.email}</em> : null}
</p>

<p>
<input type="password" name="password" />
{errors?.password ? (
<em>{errors.password}</em>
{actionData?.errors?.password ? (
<em>{actionData?.errors.password}</em>
) : null}
</p>

Expand Down

0 comments on commit 33dc6a4

Please sign in to comment.