dozoisch / dozoisch/react-async-script
Any chance you could post a Stripe example?
- Lingua principale
- JavaScript
- Stelle
- 177
- Fork
- 29
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I'm a bit confused on the examples.
I created a `Stripe.jsx` file:
```js
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 (
)
}
}
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:
```js
import Stripe from './Stripe'
...
onLoad () {
console.log('script loaded')
}
...
```
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?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.