下面的代码与 react-scripts@1.1.4
react-scripts@1.1.4
/* file auth.js */ class AuthService { ... } // export a singleton export default slug => { if (!this._authService) this._authService = new AuthService(slug) return this._authService }
我刚升级到 react-scripts@2.1.1 ,我得到了 this undefined .
react-scripts@2.1.1
this
undefined
react-scripts