Reputation: 800
I'm having a confusion over this supposed to be simple code:
In driveApi.js
:
class GoogleDriveApis {
constructor(arg) {
this.path = arg
}
test() {
console.log(this.path)
}
}
export default new GoogleDriveApis();
When I do:
import GoogleDriveApis from './driveApis'
GoogleDriveApis('abc').test()
I've got this error: TypeError: (0 , _driveApis2.default) is not a function
What did I do wrong?
Upvotes: 1
Views: 4645
Reputation: 7121
Remove this: export default new GoogleDriveApis();
and change your class to be: export default class GoogleDriveApis {
Upvotes: 3