Home > front end >  React export {...} from shorhand usage
React export {...} from shorhand usage

Time:11-21

When using

export { module } from 'path'

This doesn't work specially with default exports

but when importing then exporting no problem in index.js

import module from path  
export {module}

I'm i missing something

CodePudding user response:

If you want to re-export a default export as a named one, you can use the following syntax

export {default as module} from './path

Alternatively, if you want to export all named export in a single export, you can use

export {* as module} from './path'

CodePudding user response:

Simply because this syntax does not deal with default exports only named ones

  • Related