Last active
February 21, 2016 04:17
-
-
Save codemilli/c33b19f5e02ce6dd7b96 to your computer and use it in GitHub Desktop.
actions for Todo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Todo 의 아이디 todo 의 갯수가 늘때마다 +1 해준다. | |
let nextTodoId = 0; | |
// Todo 의 상태(completed/uncompleted) 를 변경한다. | |
export const toggleTodo = (id) => { | |
return { | |
type: 'TOGGLE_TODO', | |
id | |
}; | |
}; | |
// visible 옵션을 선택한다. | |
export const setVisible = (filter) => { | |
return { | |
type: 'SET_VISIBLE', | |
filter | |
}; | |
}; | |
// Todo 를 생성한다. | |
export const createTodo = (text) => { | |
return { | |
type: 'CREATE_TODO', | |
id: nextTodoId++, | |
text | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment