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
  • 148,457
  • 42
  • 363
  • 369
Yichaoz
  • 8,686
  • 9
  • 50
  • 91

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
  • 28,620
  • 8
  • 59
  • 91