Skip to content

Instantly share code, notes, and snippets.

@codemilli
Last active February 21, 2016 04:17
Show Gist options
  • Save codemilli/c33b19f5e02ce6dd7b96 to your computer and use it in GitHub Desktop.
Save codemilli/c33b19f5e02ce6dd7b96 to your computer and use it in GitHub Desktop.
actions for Todo
// 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