I have this paypal integration in my nextjs application. when I load the page everything loads well but when i navigate way from the page and back. It throws an error
unhandled_error: zoid destroyed all components↵
Paypal does not provide any additional information on this error at all.
My code is just a normal component
componentDidMount() {
paypal
.Buttons({
createOrder: (data, actions)=> {
return actions.order.create({
purchase_units: [{
amount: {
currency_code: "USD",
value: amount,
},
}],
});
},
onCancel: function(data){
//console.log(data)
},
onError: function(err){
console.log(err)
}
})
.render("#paypal");
}
<div id="paypal" className=""></div>
what am i doing wrong