Luehang / react-paypal-button-v2

An easy and simple to use React button component to implement PayPal Checkout with Smart Payment Buttons V2 (Version 2).
https://luehangs.site/lue_hang/projects/react-paypal-button-v2
MIT License
274 stars 81 forks source link

[BUG] Button not detecting prop changes and re renders with previous props #102

Open athoifss opened 3 years ago

athoifss commented 3 years ago

It seems like upon re rendering (through prop change) the options object does not detect the new change and still renders the checkout with old props.

<PayPalButton
        options={{ clientId: clientID, currency: props.currency }}
        createOrder={createOrder}
        onApprove={onApprove}
   />

I did an ugly hack where I am forcefully re rendering the component on props.currency change. The component re renders all right but still with the previous options . The new props.currency is not being updated in checkout.