File tree 1 file changed +22
-4
lines changed
1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
1
# About this folder
2
+
2
3
This folder holds configuration files for different environments.
3
4
You can use it to provide your app with different settings based on the
4
5
current environment, e.g. to configure different API base urls depending on
5
6
whether your setup runs in dev mode or is built for distribution.
6
7
You can include the configuration into your code like this:
7
8
9
+ ** ES2015 Modules**
10
+
11
+ ``` js
12
+ import config from ' config' ;
13
+ ```
14
+
15
+ ** Common JS**
16
+
17
+ Due to Babel6 we need to append ` .default ` .
18
+
19
+ ``` js
20
+ let config = require (' config' ).default ;
21
+ ```
22
+
23
+ ** Example**
24
+
8
25
``` javascript
9
- let react = require (' react/addons' );
10
- let config = require (' config' );
26
+ import React from ' react' ;
27
+ import config from ' config' ;
28
+
11
29
class MyComponent extends React .Component {
12
- constructor (props ) {
13
- super (props);
30
+ constructor (props , ctx ) {
31
+ super (props, ctx );
14
32
let currentAppEnv = config .appEnv ;
15
33
}
16
34
}
You can’t perform that action at this time.
0 commit comments