dozoisch / dozoisch/react-async-script

Any chance you could post a Stripe example?

Open
#20 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
177
Forks
29
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.