Skip to content
doubtly

2 answers

An action in Redux is a plain JavaScript object that describes what happened; it must have a type property and may carry data (payload).

// action
{ type: "ADD_TODO", payload: { text: "Study Redux" } }

// action creator: a function that returns an action
function addTodo(text) {
  return { type: "ADD_TODO", payload: { text } };
}

store.dispatch(addTodo("Study Redux"));
  • Actions are the only way to send data from the application to the store: they are sent with store.dispatch().
  • The store passes the action to the reducer, which reads action.type and returns the new state.
  • A function that returns an action object is called an action creator; the action itself is the object.
Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.