export default arrow function 1

export default arrow function

// You can only export anonymous functions directly
export default () => console.log("Hello World.");

// If you want named exports, you have to export it seperately
const App = () => console.log("This is an app.");
export default App;

Here is what the above code is Doing:
1. We’re exporting a function that logs “Hello World” to the console.
2. We’re exporting a function that logs “This is an app” to the console.

The first export is an anonymous function, so we can export it directly.
The second export is a named function, so we have to export it seperately.

The default export is the first export.

Similar Posts