'Sending React State to PayPal Hosted Fields
I'm currently re-rendering the hosted fields every time the card_name state changes. For some reason I cannot access any react state information inside the hosted fields. Is there a way to send the react state so that I can access it inside the window functions?
const [card_name, setCardName] = useState('')
window.paypal.HostedFields.render({
// Call your server to set up the transaction
createOrder: function () {
console.log(card_name)
},
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
