Skip to content

Commit ed232ee

Browse files
authored
Updated README in src/config/README.md (#57)
Closes #56
1 parent 0cb2072 commit ed232ee

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/config/README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
# About this folder
2+
23
This folder holds configuration files for different environments.
34
You can use it to provide your app with different settings based on the
45
current environment, e.g. to configure different API base urls depending on
56
whether your setup runs in dev mode or is built for distribution.
67
You can include the configuration into your code like this:
78

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+
825
```javascript
9-
let react = require('react/addons');
10-
let config = require('config');
26+
import React from 'react';
27+
import config from 'config';
28+
1129
class MyComponent extends React.Component {
12-
constructor(props) {
13-
super(props);
30+
constructor(props, ctx) {
31+
super(props, ctx);
1432
let currentAppEnv = config.appEnv;
1533
}
1634
}

0 commit comments

Comments
 (0)