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

Chapter 15: TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_3__.useActionState) is not a function or its return value is not iterable #765

Open
beckrecca opened this issue Jun 24, 2024 · 2 comments

Comments

@beckrecca
Copy link

Hello! One cannot proceed with the instructions as is in Chapter 15 (https://nextjs.org/learn/dashboard-app/adding-authentication).

In this chapter, we add export default function LoginForm() to the login-form.tsx file, as shown here: https://github.com/vercel/next-learn/blob/main/dashboard/final-example/app/ui/login-form.tsx#L14

However, the compiler is upset with TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_3__.useActionState) is not a function or its return value is not iterable.

Screen Shot 2024-06-24 at 3 59 20 PM

In case I missed anything, here's my code as well: https://github.com/beckrecca/pReactice/blob/main/app/ui/login-form.tsx

I haven't been able to find report of a similar error. Is there any workaround?

@dtknepper
Copy link

I'm having the exact same issue. I think its because they are using the useActionState which according to the React documentation is still in the Canary channel only.

My issue: #775**

@NemanjaMilenkovic
Copy link

Depending on the React canary version used, useFormState from react-dom might help you finish the task:
for example:

import { useFormState } from 'react-dom';

  const [errorMessage, formAction, isPending] = useFormState(
    authenticate,
    undefined
  );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants