February 2018
Intermediate to advanced
298 pages
8h 22m
English
To import a module, we need to use the import statement. The import statement comes in many different formats. Here are the formats:
import x from "module-relative-path"; import {x} from "module-relative-path"; import {x1 as x2} from "module-relative-path"; import {x1, x2} from "module-relative-path"; import {x1, x2 as x3} from "module-relative-path"; import x, {x1, x2} from "module-relative-path"; import "module-relative-path"; import * as x from "module-relative-path"; import x1, * as x2 from "module-relative-path";
An import statement consists of two parts: the variable names we want to import and the relative path of the module.
Here are the differences in these formats:
Read now
Unlock full access