Skip to content

Commit

Permalink
extract getStyles from render
Browse files Browse the repository at this point in the history
  • Loading branch information
mocheng committed Jan 22, 2017
1 parent 27cde47 commit 7692b29
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chapter-10/todo_react_motion/src/todos/views/todoList.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const willEnter = () => {
};
};

const TodoList = ({todos}) => {
const styles = todos.map(item => {
const getStyles = (todos) => {
return todos.map(item => {
return {
key: item.id.toString(),
data: item,
Expand All @@ -30,7 +30,11 @@ const TodoList = ({todos}) => {
}
};
});
}


const TodoList = ({todos}) => {
const styles = getStyles(todos);
return (
<TransitionMotion
willLeave={willLeave}
Expand Down

0 comments on commit 7692b29

Please sign in to comment.