问题
i am trying to insert array values into some table for sqlite. my arrays values are not inserted. i am strucked here that was i tried can you guide me in correct way here i am getting the response from axion json output. response.zonedetails is a array. for (var i = 0; i < response.zoneDetails.length; i++){
console.log('hi i am ');
console.log('for loop log',response.zoneDetails[i]);
var zoneNmae = response.zoneDetails[i].zonename;
var parentZoneId = response.zoneDetails[i].parentzoneid;
var levelId = response.zoneDetails[i].levelid;
var zoneId = response.zoneDetails[i].zoneid;
await this.setState({zonename: zoneNmae});
await this.setState({zoneId:zoneId});
await this.setState({parentzoneid: parentZoneId });
await this.setState({levelid:levelId});
this.initZonesDB();
//this.addZonesdetailsInfo(response.zoneDetails);
this.addZonesdetailsInfo();
this is my response :"zoneDetails": [ { "zonename": "zone1", "zoneid": 1, "parentzoneid": 10, "levelid": "2" }, { "zonename": "zone2", "zoneid": 2, "parentzoneid": 10, "levelid": "2" },
i am unable to insert all values every time,it was inserting first array of 1st index values only [0]. can any one suggest me to insert all values in good way for react native.
来源:https://stackoverflow.com/questions/57924039/react-native-insertion-of-array-values-using-react-native-sqlite-storage