Im tring to add json object to array.so i can add array to my Flat list compoentnt.but i cant understand how to add data array.
this is my code
constructor(props) {
super(props);
this.state = {
Vehicle_Details :[],
}
var text = JSON.parse(jobs);
for (var i = 0; i < text.length; i++) {
console.log(text[i]["Vehicle_Details"]);
this.setState({
Vehicle_Details:(text[i])
})
}
but this added last object only.how can i solve this?
jobs?