-
Notifications
You must be signed in to change notification settings - Fork 31k
Cannot use hooks in server components #52566
Copy link
Copy link
Closed
Labels
UpstreamRelated to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked
Metadata
Metadata
Assignees
Labels
UpstreamRelated to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked
Type
Fields
Give feedbackNo fields configured for issues without a type.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 Binaries: Node: 16.17.0 npm: 8.15.0 Yarn: 3.3.0 pnpm: N/A Relevant Packages: next: 13.4.10-canary.3 eslint-config-next: 13.4.10-canary.3 react: 18.2.0 react-dom: 18.2.0 typescript: 4.9.5 Next.js Config: output: N/AWhich area(s) of Next.js are affected? (leave empty if unsure)
App Router, ESLint (eslint-config-next)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/wix/wix-appointments-subscriptions-nextjs-template
To Reproduce
Describe the Bug
Build fails with the error
React Hook "useMyHook" cannot be called in an async function. react-hooks/rules-of-hooksExpected Behavior
Build should pass, hooks are allowed in server components provided that they don't use a client-only hook.
Which browser are you using? (if relevant)
node
How are you deploying your application? (if relevant)
Vercel/Netlify
NEXT-1437