fix: Bound handleStripeLoad to this in the constructor to prevent setState is not a function errors (#37371)
This commit is contained in:
committed by
Oliver Eyton-Williams
parent
0e143c2caf
commit
3a2db6f090
@ -48,6 +48,7 @@ class DonateModal extends Component {
|
|||||||
stripe: null
|
stripe: null
|
||||||
};
|
};
|
||||||
this.renderMaybe = this.renderMaybe.bind(this);
|
this.renderMaybe = this.renderMaybe.bind(this);
|
||||||
|
this.handleStripeLoad = this.handleStripeLoad.bind(this);
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (window.Stripe) {
|
if (window.Stripe) {
|
||||||
@ -63,7 +64,6 @@ class DonateModal extends Component {
|
|||||||
|
|
||||||
handleStripeLoad() {
|
handleStripeLoad() {
|
||||||
// Create Stripe instance once Stripe.js loads
|
// Create Stripe instance once Stripe.js loads
|
||||||
console.info('stripe has loaded');
|
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
...state,
|
...state,
|
||||||
stripe: window.Stripe(stripePublicKey)
|
stripe: window.Stripe(stripePublicKey)
|
||||||
|
Reference in New Issue
Block a user