Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG-1919] experimental app router updates to next 15 and react 19 #1994

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(experimental-app-router): Resolve onLogin issue on Vercel deploym…
…ent - updating example repo (#1919)
CesarBenavides777 committed Nov 26, 2024
commit 67de069cd57f4925d958c9adc7d7fbe6cd1df21f
17 changes: 5 additions & 12 deletions examples/next/app-router/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
'use client';

import { useFormState, useFormStatus } from 'react-dom';
import { loginAction } from './action';

function SubmitButton() {
const status = useFormStatus();
return (
<button disabled={status.pending}>
{status.pending ? 'Loading...' : 'Login'}
</button>
);
}
import { useActionState } from 'react';

export default function Page() {
const [state, formAction] = useFormState(loginAction, {});
const [state, formAction, isPending] = useActionState(loginAction, {});

return (
<>
@@ -30,7 +21,9 @@ export default function Page() {
<input type="password" name="password" />
</fieldset>

<SubmitButton />
<button disabled={isPending}>
{isPending ? 'Loading...' : 'Login'}
</button>

{state.error && (
<p dangerouslySetInnerHTML={{ __html: state.error }}></p>