Skip to content
RED SAG Skills
medium10 pts · first answer countsreacthooks

State becomes undefined after an action

After dispatching { type: "TOGGLE_THEME" }, state is undefined and the app crashes. What is the bug?

function reducer(state, action) {
  switch (action.type) {
    case "ADD": return { ...state, count: state.count + 1 }
  }
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions