dozoisch / dozoisch/react-async-script
Any chance you could post a Stripe example?
- Vorherrschende Sprache
- JavaScript
- Sterne
- 177
- Forks
- 29
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.