2017-05-31 18 views
0

我派遣一个动作:disptach动作错误,数值显示为嵌套对象

removeAchievement(achievement){ 
     this.props.removeAchievement({ 
      type: 'REMOVE_ACHIEVEMENT', 
      id: this.props.day.id, 
      text: achievement, 
    }) 
    } 

行动的创建者:

export const removeAchievement = (id, text) => ({ type: types.REMOVE_ACHIEVEMENT, id, text }) 
我减速

但是,这些数据似乎嵌在我的ID是这样的:

enter image description here

怎么能阻止它被嵌套?

+0

如果 -

this.props.removeAchievement({ type: 'REMOVE_ACHIEVEMENT', id: this.props.day.id, text: achievement, }) 

与ID和文字,而不是说它你在调度之前在你的组件中使用'console.log' this.props.day.id',你会得到什么? –

+0

向我们展示'removeAchievement'动作创建者。 – Ioan

+0

更新的问题 – Bomber

回答

2

你行动的创建者期待一个ID和文字,但你与整个对象调用它 -

this.props.removeAchievement(this.props.day.id, achievement);