官术网_书友最值得收藏!

Consuming a module

In ES2015, we use the import and from keywords to import one or several constructs like so:

import { SomeConstruct } from './module';

The imported file looks like this:

export let SomeConstruct = 5;

The basic operations involved, working with ES2015 modules, can be summarized as follows:

  • Define a module and write the business logic of the module
  • Export the constructs you want to make public
  • Consume said module with an import keyword from a consumer file 

Of course there is a bit more to it than that, so let's look at what else you can do in the next subsection.

主站蜘蛛池模板: 新乡县| 固阳县| 广丰县| 淅川县| 乌鲁木齐市| 治多县| 吉木萨尔县| 罗平县| 武冈市| 兰坪| 山阴县| 德格县| 阿拉善右旗| 贞丰县| 瑞丽市| 招远市| 怀安县| 内江市| 河曲县| 象州县| 静宁县| 无锡市| 江北区| 辽阳县| 城口县| 嘉义县| 怀集县| 和硕县| 永胜县| 武安市| 石景山区| 平潭县| 南康市| 湘潭县| 黔江区| 奉节县| 德兴市| 芜湖市| 九台市| 怀柔区| 南涧|