Actions are plain JavaScript objects that describe what happened in the application. They must have a type
property and can contain additional data (payload).
// Action object
const addTodo = {
type: 'ADD_TODO',
payload: {
id: 1,
text: 'Learn Redux'
}
};
// Action creator function
const addTodoAction = (text) => ({
type: 'ADD_TODO',
payload: { id: Date.now(), text }
});