Export and import in ES6

Export and import in ES6 post we will learn about the usage of import and export in react. “export” is used export functions, objects, or primitive values from the module the export statement cannot be used in embedded scripts.

Export and import in ES6

Export Import in ES6

There are two different types of export, named and default.

1.named exports:

  • You can have multiple named exports per module.

import named export and using:

2.default exports:

  • If we want to export a single value or to have a fallback value for our module
  • It is not possible to use var, let or const with export default.

import the default export:

3.Module export:

  • Exported default and star from another module.

 

Leave a Reply

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