Is it possible to do multiple class imports with ES6/Babel?

前端 未结 4 470
借酒劲吻你
借酒劲吻你 2020-12-28 13:10

I\'m working on a react project (my first) and I\'ve recently restructured my folder structure to make a bit more sense.

To make my life easier, within my component

4条回答
  •  长发绾君心
    2020-12-28 13:34

    One can have multiple named exports per file then import the specific exports by surrounding by braces. The name of the imported module has to be the same as the name of the exported module.

    import {Something, Somethingelse} from './utility.js'

    One can also import all exports as the following:

    import * as bundled from './utility.js'

提交回复
热议问题