componentDidUpdate(){
let arran=this.props.shipmmsi;
this.kick=arran;
this.getshipteamtemporaryDataServer()
}
getshipteamtemporaryDataServer=()=>{//didupdate
let shipmmsiarr=this.kick
var arr=[];
for(var i in shipmmsiarr){
//
((kick)=>{
Server.getshipteamtemporaryData({MMSI:kick},(data)=>{
arr.push(data);
// this.setState({//setState
// shipteampos:arr
// })
})
})(shipmmsiarr[i])
}
console.log(arr)
}
the props.shipmmsi of the sibling component is injected through dispatch, and in this component, it is obtained through the connect method of redux. However, when render is rendered, it will be rendered twice. The shipmmsi will be undefined the first time, and then the injected shipmmsi will be obtained. The props obtained in componentdidmount is an empty array, how to solve the problem that props can not get it in the didmount cycle? I"ve been trying for two days. I haven"t finished it yet. A little confused