Skip to content

Commit

Permalink
Updated src/config/README.md
Browse files Browse the repository at this point in the history
Fixed documentation for using with CommonJS-requires.
  • Loading branch information
sthzg committed Aug 17, 2016
1 parent 864baca commit 4fb12a7
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/config/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
# About this folder

This folder holds configuration files for different environments.
You can use it to provide your app with different settings based on the
current environment, e.g. to configure different API base urls depending on
whether your setup runs in dev mode or is built for distribution.
You can include the configuration into your code like this:

**ES2015 Modules**

```js
import config from 'config';
```

**Common JS**

Due to Babel6 we need to append `.default`.

```js
let config = require('config').default;
```

**Example**

```javascript
let react = require('react/addons');
let config = require('config');
import React from 'react';
import config from 'config';

class MyComponent extends React.Component {
constructor(props) {
super(props);
constructor(props, ctx) {
super(props, ctx);
let currentAppEnv = config.appEnv;
}
}
Expand Down

0 comments on commit 4fb12a7

Please sign in to comment.