fix: Bound handleStripeLoad to this in the constructor to prevent setState is not a function errors (#37371)

This commit is contained in:
Kristofer Koishigawa
2019-10-17 23:57:37 +09:00
committed by Oliver Eyton-Williams
parent 0e143c2caf
commit 3a2db6f090

View File

@ -48,6 +48,7 @@ class DonateModal extends Component {
stripe: null
};
this.renderMaybe = this.renderMaybe.bind(this);
this.handleStripeLoad = this.handleStripeLoad.bind(this);
}
componentDidMount() {
if (window.Stripe) {
@ -63,7 +64,6 @@ class DonateModal extends Component {
handleStripeLoad() {
// Create Stripe instance once Stripe.js loads
console.info('stripe has loaded');
this.setState(state => ({
...state,
stripe: window.Stripe(stripePublicKey)