next.js: TypeError: Object(...) is not a function
There is a strange error occurring, I have created a HOC to check if the user is logged in or not and then proceed as follows.
return <Component user = {user} {...props} />
The error is probably about {... props}, has anyone ever dealt with this problem?
One thing that happens is that this error only appears when I’m running yarn build && yarn start

About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (3 by maintainers)
Commits related to this issue
- Try not using array destructuring Per https://github.com/zeit/next.js/issues/5550 — committed to Axosoft/glo2markdown by deleted user 8 years ago
unrelated, sorry. I was using hooks with the default react 16.
npm i react@next react-dom@nextfixed this.Also having this issue. Everything works locally, only fails once I try to deploy to now.sh. The build step passes, but when I hit my index page, I get this error. I am also using react hooks.
@timneutkens unfortunately it’s not the space problem this started to become common in version 7.0.2
@afzalzbr i didn’t use HOC anymore, i had to use next-auth context. This article helped me out
[here](https://blog.logrocket.com/how-to-use-nextauth-js-for-client-side-authentication-in-next-js/)I was getting this error using Next.js and for me it was caused by trying to destructure a function that didn’t exist in an npm module. eg
import { loadRecaptcha } from "recaptcha-v3";instead ofimport { load } from "recaptcha-v3";and then trying to run it in an async function.