Default export
A default export is the module export designated for import as the module’s default, without requiring a matching exported name.
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
The single export in a module that is treated as the module's primary exported value and imported without curly-brace name matching.
- How it is used
- Uses a default export to share a module’s main value without making it global.
- How deep it goes
- Explains export expressions, the one-default rule, local import naming, and contrasts with named exports; does not explore module loading internals.
- Examples
- Shows statistics logging, currency formatting, and a class export; assigns a private-number guessing module as practice.
- What you can do after
- Build it from scratch by default-exporting a module’s main function and importing it under a chosen local name.
Secrets of the JavaScript Ninja, Third Edition
A module export designated as the value available through a default import.
- How it is used
- Distinguishes a module’s default value from its separately named exports in ESM imports.
- How deep it goes
- Traces default-import naming and namespace access through TypeScript-to-CommonJS output and ESM interop behavior.
- Examples
- Uses a module exporting Ranma as default alongside Akane and Shampoo as named values, then contrasts CommonJS import behavior.
- What you can do after
- Evaluate how default-import syntax and CommonJS interop affect access to a module’s exported value.
Read how Secrets of the JavaScript Ninja, Third Edition explains default export →
Secrets of the JavaScript Ninja, Second Edition
The binding or value designated as a module's default export, which can be imported under a chosen local name.
- How it is used
- Represents a module through one designated export, often when it contains a single class.
- How deep it goes
- Explains default-export syntax, arbitrary import naming, and coexistence with named exports through a worked class example.
- Examples
- Uses a Ninja class as the default export and imports it alongside a named function for comparing instances.
- What you can do after
- Apply it via ES6 import syntax to bind the default class locally, instantiate it, and combine it with a named import.
Read how Secrets of the JavaScript Ninja, Second Edition explains default export →
React Hooks in Action: With Suspense and Concurrent Mode
A default export is the single primary value that a JavaScript module can export for import without requiring a matching exported name.
- How it is used
- Designates a module’s primary importable value and supplies the component value required by React.lazy.
- How deep it goes
- Explains declaration, module-object access, destructuring, and lazy-loading requirements without examining module-loader internals.
- Examples
- Uses message utilities, module destructuring, and a calendar component loaded after a Show Calendar button click.
- What you can do after
- Apply it via JavaScript export syntax, dynamic import properties, destructuring, and React.lazy component loading.
Read how React Hooks in Action: With Suspense and Concurrent Mode explains default export →
Also covered in
- Essential TypeScript 5, Third Edition
- Vanilla WebIn early access (MEAP)
- Modern Angular
What to know first
- CommonJSCommonJS is a JavaScript module-system specification that defines how modules export and load values, traditionally using synchronous require calls and module.exports assignments.
- JavaScriptJavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
- moduleA module is a cohesive unit of code or computation that groups related functionality within a larger system and defines a scope or boundary for organizing or sharing it.
- TypeScriptTypeScript is a statically typed superset of JavaScript that adds type-system features and is compiled to JavaScript.
Related concepts
- ECMAScript moduleused by · An ECMAScript module is a separately scoped JavaScript unit whose dependencies and shared bindings are declared with import and export syntax.
- import/export syntaxkind of · Module import and export syntax declares dependencies between modules and makes selected bindings available to other modules.
- import statementused by · An import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.
- modulepart of · A module is a cohesive unit of code or computation that groups related functionality within a larger system and defines a scope or boundary for organizing or sharing it.
- named exportcontrasts with · A named export is a module binding made available under an explicit name that importing code can reference, with optional renaming.
- exportkind of · An export is a JavaScript module declaration that makes bindings available to other modules.
Questions about default export
What is default export?
A default export is the module export designated for import as the module’s default, without requiring a matching exported name.
Which Manning books explain default export?
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond, Secrets of the JavaScript Ninja, Third Edition, Secrets of the JavaScript Ninja, Second Edition and React Hooks in Action: With Suspense and Concurrent Mode.
What should I know before learning default export?
Manning books that teach default export usually introduce CommonJS, JavaScript, module and TypeScript first.
What is the difference between default export and named export?
A default export is the module export designated for import as the module’s default, without requiring a matching exported name. A named export is a module binding made available under an explicit name that importing code can reference, with optional renaming.
What is default export a kind of?
Default export is a kind of import/export syntax. Module import and export syntax declares dependencies between modules and makes selected bindings available to other modules.
What is default export part of?
Default export is part of module. A module is a cohesive unit of code or computation that groups related functionality within a larger system and defines a scope or boundary for organizing or sharing it.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



