Grokking React Advanced
Vote

0% completed

​

Working with Actions in Redux

The object below is a complete Redux action. Logging its two fields prints the event name and the data that goes with it:

const action = { type: 'todos/addTodo', payload: { id: 1, text: 'Learn Redux' } }; console.log(action.type, action.payload);
todos/addTodo { id: 1, text: 'Learn Redux' }

There is no class to extend and no function to register. An action is a plain JavaScript object that describes something that happened in the app. Components send actions to the store, and the store's reducer reads them to decide the next state

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content