Created
October 13, 2018 19:05
-
-
Save ryanbelke/2df4d4d4827a8866cfa2d879c8a5bdca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class App extends React.Component { | |
| constructor() { | |
| super(); | |
| this.state = {stripe: null}; | |
| } | |
| componentDidMount() { | |
| // Create Stripe instance in componentDidMount | |
| // (componentDidMount only fires in browser/DOM environment) | |
| this.setState({stripe: window.Stripe('pk_test_12345')}); | |
| } | |
| render() { | |
| return ( | |
| <StripeProvider stripe={this.state.stripe}> | |
| <Elements> | |
| <InjectedCheckoutForm /> | |
| </Elements> | |
| </StripeProvider> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment