State Management · Junior · Question 57 of 75

Where does the argument go when you dispatch todoAdded("Buy milk") created by createSlice?

todoAdded(state, action) {
  state.push({ text: action.payload, done: false });
}

Explanation

Generated action creators put their single argument into payload. A prepare callback can customize the payload, e.g. to add a generated id.

Further reading

Problem with a question

State Management · Junior · question 57

Test yourself

Take the State Management · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz