V
V
Vanya Huk2018-06-09 00:21:03
JavaScript
Vanya Huk, 2018-06-09 00:21:03

Where is the redux error?

I have js code

this.props.updateBrandModels( this.props.changed.filter_models.brands );

    console.log( this.props.brandModels.items )

everything is updated in the redux console
5b1af273cb750505706722.png
, but when I output the array data immediately after the method to the console, the action
code is empty there
export const updateBrandModels = (array) => {

  let object = { items: array }

  return {type: 'UPDATE_MODEL_FORM', payload: object};
}

reducer code
const initialState = {

  items : [ undefined ],

  models : []

  };

const brandModels = (state = initialState, action) => {

  switch( action.type ){

    case "UPDATE_MODEL_FORM":
      return Object.assign({}, state, action.payload );

    case  "UPDATE_MODELS":
      return Object.assign({}, state, action.payload );

    default :  return state;

  }

}

export default brandModels;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepanya, 2018-06-09
@Stepanya

Where is the redux error?

In the title

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question