Coder Social home page Coder Social logo

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This about gatsby-plugin-paypal HOT 10 CLOSED

alexislepresle avatar alexislepresle commented on June 19, 2024
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This

from gatsby-plugin-paypal.

Comments (10)

axk2 avatar axk2 commented on June 19, 2024 1

thank you, it's a very good plugin, more people should use it

from gatsby-plugin-paypal.

alexislepresle avatar alexislepresle commented on June 19, 2024

Hello @axk2,
You should try it like this:

import React from "react"
import Paypal from "gatsby-plugin-paypal"

const PaylpalButton = () => {   
   return (
      <Paypal
          style={{
              shape: 'rect',
              color: 'blue',
              layout: 'horizontal',
              label: 'paypal',
          }}
          amount={10.1}
      />
   )
}

export default PaylpalButton

from gatsby-plugin-paypal.

axk2 avatar axk2 commented on June 19, 2024

Code
error

i've just made all of the documentation, the id, the config, the install, the component, and always is the same error

from gatsby-plugin-paypal.

axk2 avatar axk2 commented on June 19, 2024

i've deleted all the cache files, node modules, etc, installed all again

from gatsby-plugin-paypal.

alexislepresle avatar alexislepresle commented on June 19, 2024

Could you invite me to your repo? So that I can look at your code 👍🏻

from gatsby-plugin-paypal.

axk2 avatar axk2 commented on June 19, 2024

sure, https://github.com/axk2/paypal-plugin-error i've replicated it for you, so it's simplier to analize

from gatsby-plugin-paypal.

alexislepresle avatar alexislepresle commented on June 19, 2024

Hello @axk2,

I just updated the packages and that's it, the issue is solved.

Thank you :)

from gatsby-plugin-paypal.

yewyewXD avatar yewyewXD commented on June 19, 2024

@alexislepresle which packages did you update? I'm facing the same issue, would really appreciate it if you share more detail :)

from gatsby-plugin-paypal.

lawrencejberry avatar lawrencejberry commented on June 19, 2024

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 (react@^17.0.1 and react-dom@^17.0.1) before installing the plug-in. The package manager then successfully picked up the plug-in's React dependency as a duplicate. The ideal solution would be to remove React as a dependency of this package as the React docs suggest.

from gatsby-plugin-paypal.

alexislepresle avatar alexislepresle commented on June 19, 2024

Hi @lawjb , @yewyewXD ,

I just fixed the issue, normally it's good now :)

from gatsby-plugin-paypal.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.