I am trying to import a function from another module but on running am getting an error:
TypeError: _this.getData is not a function.
data.js
function getData() {
return [
{ id: 1,
name: 'Pluto',
type: 'Dwarf Planet'
},
{ id: 2,
name: 'Neptune',
type: 'Planet'
}
]
}
export { getData }
worker.js
import getData from data.js
this.data = this.getData()
Then on run I get the browser error as mentioned above. Any ideas as to what I am doing incorrectly?