What are the different ways to export and re-export things from a module?
There are three export forms and four import forms, and knowing them all is what lets you read any module file quickly.
On the export side. You can put export in front of a declaration, so the declaration and the export happen together. You can export a list of existing bindings at the bottom of the file with a single export statement. And you can mark one binding as the default export, which is the module's main export and is the only one you can have per file.
On the import side. A named import uses braces and pulls one or more specific exports. A default import has no braces and gives you the default export under a name you choose. A namespace import uses the star syntax and gives you an object containing every export. And you can combine a default and named imports in one statement by putting the default name first and the named ones in braces after it.
Re-exports let a module forward what another module exports. The export from form forwards specific names, the star form forwards everything except the default, and you can also re-export a default under a new name. A module that gathers exports from several files and publishes them as one is called a barrel file, and it is a common way to give a package a single entry point.
One warning about barrels. Every file in the barrel is loaded when anything in the barrel is imported, so a barrel that re-exports large modules can slow down your start-up time and bloat your bundle. Many teams keep one barrel for the public API and use direct imports internally.