Unhandled Rejection (TypeError): Cannot read property ‘load’ of undefined

Not all the time but sometimes I get this error message. How do I fix that? Here is my code: componentDidMount() { window.gapi.load(‘auth2’, _ => { window.gapi.auth2.init({ client_id: ‘894354405179-2pjid750mdo5un30fi8la4v89f2spcqu.apps.googleusercontent.com’, seope: ’email’, fetch_basic_profile: true }).then(() => { this.Auth = window.gapi.auth2.getAuthInstance(); this.onAuthChange(this.Auth.isSignedIn.get()) this.Auth.isSignedIn.listen(this.onAuthChange) }) }) } And the script tag: <script src=”https://apis.google.com/js/platform.js?onload=init” async defer></script>

Details