0

I ask this because, If I do this in index.js

import Comp from './Component';

export default Comp

Then doing import Component from 'src/Component' WebStorm would not report as error,

but if I do in index.js

export { default } from './Component';

Then doing import Component from 'src/Component' WebStorm will say Component is not found. As far as I know it's valid and the code actually works, but is it part of the standard of ES6 this style of exporting?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Yichz
  • 9,250
  • 10
  • 54
  • 92

1 Answers1

2

You can do a named export:

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

then you would need to import it like that:

import { Component } from './path'; 
Sagiv b.g
  • 30,379
  • 9
  • 68
  • 99