Skip to content

Commit d56fa56

Browse files
committed
Use @container decorator in todo example
1 parent 7a456ec commit d56fa56

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

examples/todo/App.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
import React from 'react';
22
import Header from './Header';
33
import Body from './Body';
4-
import { root, Container } from 'redux';
5-
import { todoStore } from './stores/index';
6-
import { addTodo } from './actions/index';
4+
import { root } from 'redux';
75

86
@root
97
export default class TodoApp {
108
render() {
119
return (
12-
<Container stores={todoStore} actions={{ addTodo }}>
13-
{props =>
14-
<div>
15-
<Header addTodo={props.addTodo} />
16-
<Body todos={props.todos} />
17-
</div>
18-
}
19-
</Container>
10+
<div>
11+
<Header />
12+
<Body />
13+
</div>
2014
);
2115
}
2216
}

examples/todo/Body.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import React, { PropTypes } from 'react';
2+
import { container } from 'redux';
3+
import { todoStore } from './stores/index';
24

5+
@container({
6+
stores: todoStore
7+
})
38
export default class Body {
49
static propTypes = {
510
todos: PropTypes.array.isRequired

examples/todo/Header.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import React, { PropTypes } from 'react';
2+
import { container } from 'redux';
3+
import { addTodo } from './actions/index';
24

5+
@container({
6+
actions: { addTodo }
7+
})
38
export default class Header {
49
static propTypes = {
510
addTodo: PropTypes.func.isRequired

0 commit comments

Comments
 (0)