- Architecting Angular Applications with Redux,RxJS,and NgRx
- Christoffer Noring
- 105字
- 2021-08-27 19:56:14
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.