Cola decorator can define redux initial data, mapStateToProps and mapDispatchToProps for react-redux components, and reducers for redux as well. Decorator support both server-side and browser-side.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@Cola({
initData: {
// return any data in props
todos : async () => {
returnawaitPromise.resolve([])
}
},
mapStateToProps: state => {
return {
// return props
};
},
mapDispatchToProps: dispatch => {
return {
// return props
};
},
reducer: {
// define reducer here
}
})
classAppextendsReact.Component<Props, States> {
}
include decorator
include decorator indicate the component contain children components defined by Cola decorator.