M
M
Maxim2015-11-21 11:28:28
React
Maxim, 2015-11-21 11:28:28

Why is the store not updating in the reducer?

Here is the reducer code.

export default function(state = {
  brokers: []
}, action) {
  switch(action.type) {
    case actions.BROKERS_LOADED:
      return Object.assign({}, state, {
        brokers: action.data
      });
    default:
      return state;
  }
}

Throws the error `TypeError: props.initialData.slice is not a function` when triggered.
And if you make initialState a simple array (state = []) and return action.data in the switch, then everything works fine.
Tell me where am I wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question