dozoisch / dozoisch/react-async-script

Any chance you could post a Stripe example?

Offen
#20 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
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 (

{this.state.message}

)
}
}

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.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.