I have declare a class in a FoodItem.js file like
export default class FoodItem {
constructor(name) {
this.name = name;
}
methodOne() {
//statement
}
}
And then in index.js file (same directory as FoodItem.js) I do an import like
import FoodItem from './FoodItem';
When I run it, I got an error
Cannot use import statement outside a module.
Can anyone tell what is wrong with the export/import syntax?