I'm a bit confused on the examples.
I created a Stripe.jsx file:
import React, { Component } from 'react'
import makeAsyncScriptLoader from 'react-async-script'
class Stripe extends Component {
constructor () {
super()
this.state = {
message: 'INIT...'
}
}
stripeJSLoaded (msg) {
console.info('loaded.')
this.setState({ message: 'Loaded.' })
}
render () {
return (
<div>{this.state.message}</div>
)
}
}
const callbackName = 'stripeJSLoaded'
const URL = 'https://js.stripe.com/v3/'
const globalName = 'stripe'
export default makeAsyncScriptLoader(Stripe, URL, {
callbackName,
globalName
})
Within the App.jsx I'm loading it:
import Stripe from './Stripe'
...
onLoad () {
console.log('script loaded')
}
...
and rendering it:
<Stripe asyncScriptOnLoad={ this.onLoad } />
I get 'INIT...' on the screen, but nothing in the console or elsewhere.
At this point I'm just trying to get ANYTHING to load and then change some status to let me know it did it, let alone using that script.
Help?
I'm a bit confused on the examples.
I created a
Stripe.jsxfile:Within the
App.jsxI'm loading it:and rendering it:
I get 'INIT...' on the screen, but nothing in the console or elsewhere.
At this point I'm just trying to get ANYTHING to load and then change some status to let me know it did it, let alone using that script.
Help?