An ES6 module’s exports are its public interface: other modules can access identifiers marked for export, while unexported top-level identifiers remain private to that module. Use export to share only what callers need; pair it with import to use those bindings elsewhere. section 11.2 section 11.2.1
Export identifiers in a few common ways:
- Prefix a variable, function, or class declaration with export. section 11.2.1
- Export declarations together at the end of a module, optionally giving an exported identifier a new name with as. section 11.2.1
- Use export default for the module’s single default export; named and default exports can coexist. section 11.3
Named exports can be imported by name or renamed with as; a default export is imported without braces. Keep the exported interface intentional: unmarked bindings do not become available just because they sit at the top level. section 11.2.1
