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
You can have multiple named exports per module but only one default export. Each type corresponds to one of the above syntax. ... // export features declared elsewhere export { myFunction2, myVariable2 }; // export individual features (can export var, let, // const, function, class) export let myVariable = Math.sqrt(2); export function myFunction() { // …
Discussions

What's the difference between export function vs export default?

I use export default when exporting only one component.

If you have multiple components per file to export then use just 'export' and then on the file you want to import them you can do it this way:

import { Head, Logo, Menu } from './Header';

More on reddit.com
🌐 r/reactjs
10
6
January 21, 2020
ES6 export default function - javascript
can I export more than one function per file ? it seems like when I do that , the second function ovverides the first one , example : in my index.js file : export default function aFnt(){ c... More on stackoverflow.com
🌐 stackoverflow.com
how to export and import default function - javascript
You are naming your export default. Try this: ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... New site design and philosophy for Stack Overflow: Starting February 24, 2026... I’m Jody, the Chief Product and Technology Officer at Stack Overflow. Let’s... 3 How to get Javascript's IMPORT EXPORT working. Do I need transpiler? 0 How to properly require a node module, exporting all the functions ... More on stackoverflow.com
🌐 stackoverflow.com
What is export default?
This is good when you want individual functions or variables or objects or whatever it was that was exported · Very often though you have a single thing you want to export, and each file can have one default export. For example: · The React UI library has a default export, which contains ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
1
July 18, 2019
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › modules
Export and Import
In some situations the default keyword is used to reference the default export. For example, to export a function separately from its definition:
🌐
Stack Abuse
stackabuse.com › bytes › what-is-export-default-in-javascript
What is "export default" in JavaScript?
October 11, 2023 - export default is typically used when a module only has one thing to export. This could be a function, a class, an object, or anything else that you want to be the main focus of the module.
🌐
DhiWise
dhiwise.com › post › export-default-function-react-the-keystone-of-modular-code
The Power of Export Default Function in React
March 1, 2024 - Export default function in React simplifies component management and enhances code readability, making it a cornerstone for developers. In React development, the phrase 'export default function' is more than just a piece of syntax; it's a ...
Find elsewhere
🌐
React
react.dev › learn › importing-and-exporting-components
Importing and Exporting Components – React
Export your function component from that file (using either default or named exports).
🌐
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 enables you to reuse and promote a modular and organized code structure. In JavaScript, there are two main ways to export values: default exports, used for a single value per file, and named exports, allowing multiple exports per file.
🌐
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. ... Now because we used the default keyword here, only the add function will be able to be exported from this file.
🌐
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 - He said that some earlier designs of default exports were in the form export default = thing, which would have made it more obvious that thing is treated as an expression. I agree! This came to light when Dominic messaged me about circular dependencies. First we need to talk about 'hoisting': You might have encountered the age-old weird thing JavaScript does to functions:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › difference-between-default-named-exports-in-javascript
Difference Between Default & Named Exports in JavaScript - GeeksforGeeks
August 5, 2025 - Default exports allow importing with any name. Named exports require importing by the exact name. Named exports let us export several things from a module, giving each one a specific name.
🌐
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 - A default export allows you to export a single value from a module. This value can be a function, class, object, or primitive.
🌐
GeeksforGeeks
geeksforgeeks.org › what-is-export-default-in-javascript
What is export default in JavaScript ? | GeeksforGeeks
January 10, 2025 - Default exports are used when you want to export a single primary object, function, or variable from a module.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
What is export default? - JavaScript
July 18, 2019 - This is good when you want individual functions or variables or objects or whatever it was that was exported · Very often though you have a single thing you want to export, and each file can have one default export. For example: · The React UI library has a default export, which contains ...
🌐
Amit Merchant
amitmerchant.com › difference-between-export-and-export-default-in-typescript
Difference between Export and Export Default in TypeScript
August 28, 2020 - And because, it’s important to have a named declaration (such as a variable, function, class, type alias, or interface), you can export multiple declarations from the same file. So, the following is valid. // main.ts class Users { fetchUsers() { console.log('Users component is loaded...') } } class Posts { fetchPosts() { console.log('Posts component is loaded...') } } export {Users, Posts} This can be imported like so. ... On the other hand, if you export a declaration using export default, it’s not mandatory to use named declarations.
🌐
Prospera Soft
prosperasoft.com › blog › web-app-development › nodejs › javascript-export-default-explained
Understanding Export Default in JavaScript
To use 'export default', you can apply it in two main ways: either declaring a variable/function/class at the time of export or exporting an unnamed function or class.
🌐
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 - 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.