-
Notifications
You must be signed in to change notification settings - Fork 4
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
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This #1
Comments
Hello @axk2,
|
i've deleted all the cache files, node modules, etc, installed all again |
Could you invite me to your repo? So that I can look at your code 👍🏻 |
sure, https://github.com/axk2/paypal-plugin-error i've replicated it for you, so it's simplier to analize |
Hello @axk2, I just updated the packages and that's it, the issue is solved. Thank you :) |
thank you, it's a very good plugin, more people should use it |
@alexislepresle which packages did you update? I'm facing the same issue, would really appreciate it if you share more detail :) |
Hi @alexislepresle, thanks for creating this package, it's really nifty! @yewyewXD I think this issue is still around and stems from the fact that the package is specifying React as a dependency rather than just a peer dependency. I was able to get around it by installing React 17 ( |
… of a function component. This #1
Hi @lawjb , @yewyewXD , I just fixed the issue, normally it's good now :) |
×
i have this error when i try to use this plugin
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
//component
`
import React from "react"
import Paypal from "gatsby-plugin-paypal"
const PaylpalButton = () => (
<Paypal
style={{
shape: 'rect',
color: 'blue',
layout: 'horizontal',
label: 'paypal',
}}
amount={10.1}
/>
)
export default PaylpalButton
`
//just a simple page
`
import React from 'react'
import PaypalButton from '../components/PaypalButton'
const Home= () => {
return (
)
}
export default Home
`
//config
.... plugins: [ { resolve:
gatsby-plugin-paypal, options: { clientId: process.env.PAYPAL_ID } }, .... ] ....
plugin version 1.1
The text was updated successfully, but these errors were encountered: