3 ms·
Semantic difference between default and named exports is that as a user of the module you are forced to choose a name for the default export, and these names wi
by kozak 9y ago
Semantic difference between default and named exports is that as a user of the module you are forced to choose a name for the default export, and these names will likely be different across different usages of the module. For linking units within one project, this is a bad thing, because you should be consistent in naming your things. But for modules that are published to the global NPM, maybe why not.
- k__ 9y agoIf you import stuff from many libs, chances are they're named the same and you have to rename them anyway
- ljharb 9y ago1) you should be consistent, it's not your place to force users of your code what to name things 2) `import { foo as myBetterName } from 'path'`; your argument (about consistent names) is invalid :-p