Skip to content

Any chance you could post a Stripe example? #20

Description

@zeg-io

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions