import & export
484 ワード
es 6では
exportのやり方はたくさんありますがimportの時も
ユーザーは、あなたが出力したものが何なのか知りたくない場合があります.デフォルトの出力を設定することができます.
これで直接引用できます
でも時々、実はdefaultと書いていないので、それでは
export { a, b, c}
export function....
exportのやり方はたくさんありますがimportの時も
import {firstName, lastName, year} from './profile';
ユーザーは、あなたが出力したものが何なのか知りたくない場合があります.デフォルトの出力を設定することができます.
export default ...
これで直接引用できます
import profile from './profile';
でも時々、実はdefaultと書いていないので、それでは
import * as profile from './profile';