https://stackoverflow.com/questions/48064389/how-to-access-class-variable-inside-promise-then-function
If you pass a function reference, this
won't point to the local class instance anymore.
You can use bind
.then(this.extractData.bind(this))
or arrow functions
.then((res) => this.extractData(res))
to get the desired behavior.
Không có nhận xét nào:
Đăng nhận xét