ES6 module feature helps to attain the same benefits as the previous module systems and patterns, just that we now have a native feature and standard. Let's write our first module.
From the above code, we created a js file that exports a class. We can even export functions, values, objects. Also, we exported the class with the default keyword, which is one method. We can export without using the default keyword. Either of these has its own way of importing the exported information. Now let's import the information we exported.
In case, we omit the default keyword, then, the syntax will differ.
Explore further on Js modules with this section of explorejs and a talk from Kent C. Dodds;
Top comments (1)