Question about ES6 Modules - Import and Export


#1

I have a question about the JavaScript ES6 Modules section, regarding import and export statements. There is this bit of example code.

In the code, what is the purpose of the curly braces around import { functionOne } ? Why not simply import functionOne ?

Thanks!


#2

Importing without the curly braces only works for the default export.

You would need to use export default functionOne when exporting. It’s because you can export multiple times from a file but only export one default.


#3

Great, thanks.