Created
July 26, 2016 17:47
-
-
Save johntran/0fb3a9185bc3fc96c8d9d43f064fb41e to your computer and use it in GitHub Desktop.
Lazy Loading JavaScript files in React
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import makeAsyncScriptLoader from 'react-async-script'; | |
const BillingInformationForm = () => (<div>Stripe!</div>) | |
export const BillingInformationFormAsync = makeAsyncScriptLoader(BillingInformationForm, 'https://js.stripe.com/v2/', { | |
globalName: 'Stripe', | |
callbackName: 'stripeCallBack', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment