-
Notifications
You must be signed in to change notification settings - Fork 103
Importing Files
kazuho edited this page Jul 3, 2012
·
7 revisions
By using the import statement, it is possible to refer to classes defined in other source files.
The statement has several variations. All the import statement must appear before the first class (or interface or mixin) declaration within the source file.
// import all classes that do not start with "_" from "a.jsx"
import "a.jsx";
// import two classes C1 and _Internal from "a.jsx"
import C1, _Internal from "a.jsx";
// import all classes that do not start with "_" under prefix A
import "a.jsx" into A; // class C1 of a.jsx can be referred to as: A.C1
// import all files under directory "sub"
import "sub/*.jsx";
Note: JSX does not use a hierarchical namespace model. It instead adopts per-source file namespace model, which can also be found in Python and node.js.