Error : Error: Objects are not valid as a React child found: object with keys {id,image}
How do i properly render data id and image into listview?
constructor(props) {
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows([
'NA', 'NA', 'NA', 'NA'
]),
paused: true,
}
}
componentWillMount(){
this._loadGroups();
}
loadGroups(){
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
fetch(`http://www.link.com/api/v1/list`)
.then(response => response.json())
.then(dataSource => this.setState({ dataSource:ds.cloneWithRows(dataSource), paused: true }))
.catch(err => console.log(err))
.done();
}
<ListView
dataSource={this.state.dataSource}
renderRow={this._renderRow}
/>
Json Data format as follows
{
"error": "0",
"data": [{
"id": 54,
"image": "url.jpg",
}]
}