Skip to content

Commit

Permalink
fix: Fix form data not updating
Browse files Browse the repository at this point in the history
Use suggestion from remix-run/remix#1797
  • Loading branch information
bmaupin committed Feb 4, 2022
1 parent dbaa937 commit 185b6bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/routes/admin/$slug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
useTransition,
Form,
LoaderFunction,
useLocation,
} from 'remix';
import invariant from 'tiny-invariant';

Expand All @@ -19,13 +20,14 @@ export const action = newPostAction;

export default function EditPost() {
const errors = useActionData();
const location = useLocation();
const post = useLoaderData();
const transition = useTransition();

console.log('post=', post);

return (
<Form method="post">
<Form key={location.key} method="post">
<p>
<label>
Post Title: {errors?.title ? <em>Title is required</em> : null}
Expand Down

0 comments on commit 185b6bf

Please sign in to comment.