Skip to content
RED SAG Skills
hardStudy question · answer published in React interview questions, so no pointsreacthooksstrict-mode

Items added twice in development

In development, each ADD dispatch adds the item twice. In production it is fine. What is the bug?

function reducer(state, action) {
  if (action.type === "ADD") {
    state.items.push(action.item)
    return { ...state }
  }
  return state
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions