I researched the parts of ES6 export and import that I hadn't fully understood.
How to Use export
The
exportstatement is used to export functions, objects, or primitives from a given file (or module). Source: MDN - Export
Here, "export" can be thought of as defining something.
There are two ways to export.
Named Export
You can also export using from.
Default Export
default means "if nothing specific is specified during import, this class or function will be called." If you want to call a class or function other than the default during import, specify the class or file name in {}.
How to Use import
The
importstatement is used to import functions, objects, or primitives that have been exported from an external module or another script. Source: MDN - Import
There are also two ways to import.
Named Import
Strictly speaking, scope-related topics are involved, but please refer to the reference sites for more details.
Default Import
Note
It will cause an error if you try to import a default-specified member with a named import.
Thoughts
I feel like I still have a lot to catch up on with modern JavaScript, so I need to study more... (´・ω・`)