Reputation: 81
currently i setup paypal payment and everything works good but got one error here:
Uncaught Error: Detected container element removed from DOM
I declared const price with usestate and on change i display the paypal button. I did this because i also got error if the price is 0 so i hide it when price is < 1.. I also tried here to add some class and tryed with display:none or opacity:1 .. I know this can work even like this but i would like to get my errors clean..
{price > 0 && (
<PayPalButton></PayPalButton>
)}
package: https://www.npmjs.com/package/react-paypal-button-v2
Best regards..
Upvotes: 0
Views: 2691
Reputation: 30377
That type of error happens when the button is removed and regenerated too quickly. It's not necessarily a problem since the regenerated button may still work, but you should avoid rendering one too soon if it is going to change right away by something re-rendering a new one.
Would also recommend using the newer and official react-paypal-js
instead; storybook here: https://paypal.github.io/react-paypal-js/?path=/docs/example-paypalbuttons--default
Upvotes: 2