Skip to content

Commit

Permalink
apply redux-thunk
Browse files Browse the repository at this point in the history
  • Loading branch information
KoheiAsano committed Dec 18, 2018
1 parent b188ec8 commit 99595b6
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/actions/index.js
@@ -1,14 +1,23 @@
let nextTodoId = 0
export const addTodo = text => ({
type: 'ADD_TODO',
id: nextTodoId++,
text
})
export const toggleTodo = id => ({
type: 'TOGGLE_TODO',
id
})
export const setVisibilityFilter = filter => ({
type: 'SET_VISIBILITY_FILTER',
filter
})

let nextTodoId = 0;
export const addTodo = text => dispatch => {
return dispatch({
type: 'ADD_TODO',
id: nextTodoId++,
text
})
}

export const toggleTodo = id => dispatch => {
return dispatch({
type: 'TOGGLE_TODO',
id
})
}

export const setVisibilityFilter = filter => dispatch =>{
return dispatch({
type: 'SET_VISIBILITY_FILTER',
filter
})
}

0 comments on commit 99595b6

Please sign in to comment.