search

Home  >  Q&A  >  body text

javascript - When using combineReducers, the reducer and action are named differently and the action cannot be executed

There is only one reducer at the beginning, so it can be used directly by introducing it in the entry file.
Later, when there were more reducers and more actions, I wanted to split the reducers out and merge them into one large reducer through combineReducers before giving it to createStore.
But I found that if the action and the corresponding reducer are not named the same, the action will not be executed.
Has anyone encountered the same problem? What should I do if the names of action and reducer are different?

PHP中文网PHP中文网2741 days ago745

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-06-26 10:58:41

    Your usage is wrong. Just match the type of action dispatch with the type in reducer

    reply
    0
  • Cancelreply