Not sure what it means when we include function within curly brackets. Can you tell the difference between the following two lines?
import {sportsPage} from 'sports-page';
import sportsPage from 'sports-page';
Not sure what it means when we include function within curly brackets. Can you tell the difference between the following two lines?
import {sportsPage} from 'sports-page';
import sportsPage from 'sports-page';
Here's a good read on ES6 modules: https://24ways.org/2014/javascript-modules-the-es6-way/
The difference between those two, is that brackets {}
are used when you are not exporting a default
module. You can't rename them!
Without brackets, the exported function, variable, etc needs to be a default
. You can name myFunction
whatever you like.
export default myFunction;
...
import somethingsomethingDangerZone from "myfunction.js";