forked from goatslacker/alt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AltContainer.js
69 lines (66 loc) · 1.62 KB
/
AltContainer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* AltContainer.
*
* There are many ways to use AltContainer.
*
* Using the `stores` prop.
*
* <AltContainer stores={{ FooStore: FooStore }}>
* children get this.props.FooStore.storeData
* </AltContainer>
*
* You can also pass in functions.
*
* <AltContainer stores={{ FooStore: function () { return { storeData: true } } }}>
* children get this.props.FooStore.storeData
* </AltContainer>
*
* Using the `store` prop.
*
* <AltContainer store={FooStore}>
* children get this.props.storeData
* </AltContainer>
*
* Passing in `flux` because you're using alt instances
*
* <AltContainer flux={flux}>
* children get this.props.flux
* </AltContainer>
*
* Using a custom render function.
*
* <AltContainer
* render={function (props) {
* return <div />;
* }}
* />
*
* Using the `transform` prop.
*
* <AltContainer
* stores={{ FooStore: FooStore, BarStore: BarStore }}
* transform={function(stores) {
* var FooStore = stores.FooStore;
* var BarStore = stores.BarStore;
* var products =
* FooStore.products
* .slice(0, 10)
* .concat(BarStore.products);
* return { products: products };
* }}
* >
* children get this.props.products
* </AltContainer>
*
* Full docs available at http://goatslacker.github.io/alt/
*/
var React = require('react/addons')
var mixinContainer = require('./mixinContainer')
var assign = require('../utils/functions').assign
var AltContainer = React.createClass(assign({
displayName: 'AltContainer',
render: function () {
return this.altRender('div')
}
}, mixinContainer(React)))
module.exports = AltContainer