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

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.