ReactScriptLoader icon indicating copy to clipboard operation
ReactScriptLoader copied to clipboard

Change the name of StripeButton in the example

Open dcaravana opened this issue 9 years ago • 3 comments

Just a little advice: change that name to something like ReactStripeButton because checkout.js defines StripeButton, too, so when you build the React objects the first time all is fine (because stripe's script is loaded asynchronously), then if something happens that require to access again to the React object StripeButton was pointing to (like a setState() call), React throws exception (Uncaught TypeError: type.toUpperCase is not a function).

Really a little nasty bug, it took my hours to figure out and fix it.

dcaravana avatar Apr 25 '15 19:04 dcaravana

I'll be happy to make the change. Would you like to submit a diff?

yariv avatar Apr 26 '15 17:04 yariv

Yep sure! Double check it since I didn't try it (my own code already diverged too much from this).

https://gist.github.com/dcaravana/4d9c2903f2ca2afa7e7b

dcaravana avatar Apr 27 '15 08:04 dcaravana

BTW stripe module: https://github.com/azmenak/react-stripe-checkout

dmitry avatar Apr 20 '16 14:04 dmitry