October 2019
Intermediate to advanced
426 pages
11h 49m
English
We have already defined the action creator functions earlier, in src/App.js. We can now copy them from our App component, making sure that we adjust the type property in order to use the action type constants, instead of a static string.
Let's define the synchronous action creators now:
import { ADD_TODO, TOGGLE_TODO, REMOVE_TODO, FILTER_TODOS} from './actionTypes'
export function addTodo (title) { return { type: ADD_TODO, title }}export function toggleTodo (id) { return { type: TOGGLE_TODO, id }}export function removeTodo (id) { return ...Read now
Unlock full access