It's part of the ES6 module system, described here. There is a helpful example in that documentation, also:

If a module defines a default export:

// foo.js
export default function() { console.log("hello!") }

then you can import that default export by omitting the curly braces:

import foo from "foo";
foo(); // hello!

Update: As of June 2015, the module system is defined in §15.2 and the export syntax in particular is defined in §15.2.3 of the ECMAScript 2015 specification.

Answer from p.s.w.g on Stack Overflow
Top answer
1 of 12
708

It's part of the ES6 module system, described here. There is a helpful example in that documentation, also:

If a module defines a default export:

// foo.js
export default function() { console.log("hello!") }

then you can import that default export by omitting the curly braces:

import foo from "foo";
foo(); // hello!

Update: As of June 2015, the module system is defined in §15.2 and the export syntax in particular is defined in §15.2.3 of the ECMAScript 2015 specification.

2 of 12
271

export default is used to export a single class, function or primitive from a script file.

The export can also be written as

export default function SafeString(string) {
  this.string = string;
}

SafeString.prototype.toString = function() {
  return "" + this.string;
};

This is used to import this function in another script file

Say in app.js, you can

import SafeString from './handlebars/safe-string';

A little about export

As the name says, it's used to export functions, objects, classes or expressions from script files or modules

Utiliites.js

export function cube(x) {
  return x * x * x;
}
export const foo = Math.PI + Math.SQRT2;

This can be imported and used as

App.js

import { cube, foo } from 'Utilities';
console.log(cube(3)); // 27
console.log(foo);    // 4.555806215962888

Or

import * as utilities from 'Utilities';
console.log(utilities.cube(3)); // 27
console.log(utilities.foo);    // 4.555806215962888

When export default is used, this is much simpler. Script files just exports one thing. cube.js

export default function cube(x) {
  return x * x * x;
};

and used as App.js

import Cube from 'cube';
console.log(Cube(3)); // 27
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Statements › export
export - JavaScript - MDN Web Docs
The export default syntax allows any expression. ... As a special case, functions and classes are exported as declarations, not expressions, and these declarations can be anonymous.
🌐
Jakearchibald
jakearchibald.com › 2021 › export-default-thing-vs-thing-as-default
`export default thing` is different to `export { thing as default }` - JakeArchibald.com
July 3, 2021 - If export default function wasn't special-cased, then the function would be treated as an expression, and the log would be "undefined". Special-casing functions also helps with circular dependencies, but I'll get onto that shortly. ... // These give you a live reference to the exported thing(s): import { thing } from './module.js'; import { thing as otherName } from './module.js'; import * as module from './module.js'; const module = await import('./module.js'); // This assigns the current value of the export to a new identifier: let { thing } = await import('./module.js'); // These export a live reference: export { thing }; export { thing as otherName }; export { thing as default }; export default function thing() {} // These export the current value: export default thing; export default 'hello!';
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › what-is-export-default-in-javascript
What is export default in JavaScript ? - GeeksforGeeks
January 10, 2025 - JavaScript modules allow you to organize code into separate files, making it easier to maintain and reuse. To share code between modules, JavaScript provides two types of exports: Named Exports and Default Exports.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › difference-between-default-named-exports-in-javascript
Difference Between Default & Named Exports in JavaScript - GeeksforGeeks
August 5, 2025 - Default exports in JavaScript allow a module to export a single value or entity as the default export.
🌐
DEV Community
dev.to › samyak112 › export-vs-export-default-in-js-2fbi
Export vs Export Default in JS - DEV Community
December 9, 2023 - When you see export default in a Javascript or React file, it means that the module is exporting a default value.
🌐
Cichocinski
cichocinski.dev › blog › using-default-exports-makes-javascript-harder
Using Default Exports Makes JavaScript Harder to Read!
October 10, 2022 - You can suggest a different name ... to import everything from the module using import * as X syntax. And default export is just available under default....
Find elsewhere
🌐
DEV Community
dev.to › davidemaye › understanding-javascript-exports-default-export-vs-named-export-4kbh
Understanding JavaScript Exports: Default Export vs. Named Export - DEV Community
July 6, 2024 - This article explains these two export types, their differences, and when to use each. A default export is used to export a single value from a module. This value can be a function, class, object, or primitive and doesn't need a specific name.
🌐
freeCodeCamp
freecodecamp.org › news › difference-between-default-and-named-exports-in-javascript
What's the Difference Between Default and Named Exports in JavaScript?
August 14, 2023 - This means you can export one main thing using export default, while also exporting multiple additional values using export. This flexibility allows you to organize and share different parts of your code efficiently, making it easier for other parts of your application to access and use the exported functionalities. In this final section, you'll create a cool color flipper app using JavaScript modules.
🌐
Stack Abuse
stackabuse.com › bytes › what-is-export-default-in-javascript
What is "export default" in JavaScript?
October 11, 2023 - By the end, you should have a better understanding of how and when to use export default in your code. JavaScript modules are self-contained pieces of code that can be exported and imported into other JavaScript files. They help in organizing code, making it more maintainable, and more reusable.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › modules
Export and Import
Modules provide a special export default (“the default export”) syntax to make the “one thing per module” way look better.
🌐
Reddit
reddit.com › r/reactjs › can someone explain me what does export default do?
r/reactjs on Reddit: Can someone explain me what does export default do?
November 22, 2022 -

Does it export the whole file, the whole component and everything in his scope or ? ( I am confused since I see we have the same name file as the name of the function (react component) and we use the same casing. So which one is getting targeted? Thanks.

🌐
Gitbook
demirels-organization.gitbook.io › javascript-tutorial › default-export
Default Export | JavaScript Tutorial
In JavaScript, you can use the export default statement to specify a default export for a module.
🌐
Medium
medium.com › @ibeanuhillary › default-export-vs-named-export-which-is-better-51faa54a5937
Default Export vs. Named Export: Which is Better? | by Hillary Ibeanu | Medium
May 28, 2024 - Both default and named exports have their place in JavaScript development. Default exports offer simplicity for modules with a single export, while named exports provide clarity and better tooling support for modules with multiple exports.
🌐
Reddit
reddit.com › r/javascript › default exports in javascript modules are terrible
r/javascript on Reddit: Default Exports in JavaScript Modules Are Terrible
September 1, 2022 - The renaming justification is stupid because it's literally easier to rename a default export than a named import. Seriously guys, tell me you're a mid level engineer without telling me you're a mid level engineer. (Hint, argue about stupid stuff that doesn't really matter when it comes to actually solving a problem) You guys don't know how good you have it. When I started with JavaScript we didn't have block scoping, not let or const, we didn't have native Promise let alone async/await.
🌐
React
react.dev › learn › importing-and-exporting-components
Importing and Exporting Components – React
Exports the root App component as a default export. You may encounter files that leave off the .js file extension like so: ... Either './Gallery.js' or './Gallery' will work with React, though the former is closer to how native ES Modules work. ... There are two primary ways to export values with JavaScript: default exports and named exports.
🌐
Medium
medium.com › @heshramsis › understanding-the-difference-between-export-default-and-export-with-named-exports-in-javascript-f0569c221a3
Understanding the Difference between export default and export with Named Exports in JavaScript | by Hesh Ramsis ( Hesham El Masry 77 ) | Medium
August 15, 2023 - In summary, export default and export with named exports are two ways to export code from a JavaScript module. export default is used to export a single value as the default export, while export with named exports is used to export multiple ...
🌐
W3Schools
w3schools.com › js › js_modules_export.asp
JavaScript Modules Export
Named exports enable bundlers to remove unused code (tree-shaking). In this example PI, subract, multiply, and divide is removed: ... Default Export exports one main value from a module.
🌐
Medium
dev-aditya.medium.com › default-exports-vs-named-exports-in-esm-a-deep-dive-for-javascript-developers-b0803271de5d
Default Exports vs Named Exports in ESM and CJS: A Deep Dive for JavaScript Developers | by Aditya Yadav | Medium
December 21, 2024 - Flexibility: Importers can rename the export as needed. Best for Single Responsibility: Ideal when your module offers one core feature or function. A module can only have one default export.