Categories
JavaScript Answers

How to export an imported module in a single line with JavaScript?

Spread the love

Sometimes, we want to export an imported module in a single line with JavaScript.

In this article, we’ll look at how to export an imported module in a single line with JavaScript.

How to export an imported module in a single line with JavaScript?

To export an imported module in a single line with JavaScript, we can use the export keyword.

For instance, we write:

export {default as Module} from './Module/Module';

to export the ./Module/Module module as a default export.

Then we can import the exported module as a default import in another module.

Conclusion

To export an imported module in a single line with JavaScript, we can use the export keyword.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *