Reactjs 反应';s setState似乎删除了一系列项

Reactjs 反应';s setState似乎删除了一系列项,reactjs,Reactjs,这真的很奇怪,因为我已经使用setState几个月了,这是我第一次看到这个问题。我有一些代码,只是将状态属性设置为另一个对象。在要设置的对象中,有一个属性是名为GroupModel的数组。奇怪的是,一旦这个对象get在setState中被设置,属性GroupModel get就被转换成一个对象,我就失去了它的成员。我在这个对象中有其他数组属性,它们不受影响 // just before the call to setState I check newUserGridConfig and find

这真的很奇怪,因为我已经使用setState几个月了,这是我第一次看到这个问题。我有一些代码,只是将状态属性设置为另一个对象。在要设置的对象中,有一个属性是名为GroupModel的数组。奇怪的是,一旦这个对象get在setState中被设置,属性GroupModel get就被转换成一个对象,我就失去了它的成员。我在这个对象中有其他数组属性,它们不受影响

// just before the call to setState I check newUserGridConfig and find that its child property, 
// GroupModel, is indeed an array and has the expected child elment.
self.setState({ localGridConfig: newUserGridConfig }, () => {

    // once setState completes I check self.state.localGridConfig.GroupModel and 
    // find that it is now an object (i.e. [object Object]). 
    // I then check newUserGridConfig.GroupModel and 
    // it is still an array and has the expected element in it
    var response = self.updateUserGridConfigurationStore(self.state.localGridConfig, 
    saveNetwork);

这是因为setState是异步的,不能保证立即运行。因此,我有一些其他的代码,它们设法介于两者之间,并首先设置属性