<commit_before>Cortex is a Javascript library for centrally managing data with React.

**Key features:**
- supports deeply nested data with a simple API
- performs old and new data comparison out of the box so you don't have to implement shouldComponentUpdate
- performs batch updates and efficiently rewraps only the affected subtree.
- has built-in methods for working with arrays and hashes

**Demos**

[skyline (4-level nested components)](http://mquan.github.io/cortex/examples/skyline/)

[file system (arbitrarily deep structure of a single component type)](http://mquan.github.io/cortex/examples/file_system/)

# Quickstart
Initialize a cortex object
```javascript
var data = {a: 100, b: [1, 2, 3]};

var cortex = new Cortex(data, function() {
  //trigger your React component to update props
});
```

Get a nested cortex object
```javascript
cortex.a

//Also works
cortex['a']
```

Get a nested cortex element in an array
```javascript
cortex.b[0]
```

Get the actual value
```javascript
cortex.a.getValue()
// ==> 100
```

Change data
```javascript
cortex.a.set(200);
cortex.a.getValue();
// ==> 200
```

Add callbacks
```javascript<commit_msg>Add root object setting example<commit_after>Cortex is a Javascript library for centrally managing data with React.

**Key features:**
- supports deeply nested data with a simple API
- performs old and new data comparison out of the box so you don't have to implement shouldComponentUpdate
- performs batch updates and efficiently rewraps only the affected subtree.
- has built-in methods for working with arrays and hashes

**Demos**

[skyline (4-level nested components)](http://mquan.github.io/cortex/examples/skyline/)

[file system (arbitrarily deep structure of a single component type)](http://mquan.github.io/cortex/examples/file_system/)

# Quickstart
Initialize a cortex object
```javascript
var data = {a: 100, b: [1, 2, 3]};

var cortex = new Cortex(data, function() {
  //trigger your React component to update props
});
```

Get a nested cortex object
```javascript
cortex.a

//Also works
cortex['a']
```

Get a nested cortex element in an array
```javascript
cortex.b[0]
```

Get the actual value
```javascript
cortex.a.getValue()
// ==> 100
```

Change data
```javascript
cortex.a.set(200);
cortex.a.getValue();
// ==> 200
```

Change data from root object
```javascript
cortex.set({a: 300})
cortex.getValue()
// ==> {a: 300}
```

Add callbacks
```javascript
{'fraction_non_alphanumeric': 0.12566955088586731, 'fraction_numerical': 0.016481252575195716, 'mean_word_length': 4.594470046082949, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2030345', 'n_tokens_mistral': 813, 'n_tokens_neox': 717, 'n_words': 282}