"data": {
"offset": 0,
"limit": 20,
"total": 1,
"count": 1,
"results": [
{
"id": 1009144,
"name": "A.I.M.",
"modified": "2013-10-17T14:41:30-0400",
"thumbnail": {
"path": "i.annihil.us/u/prod/marvel/i/mg/6/20/52602f21f29ec",
"extension": "jpg"
},
"resourceURI": "gateway.marvel.com/v1/public/characters/1009144",
"comics": {
"available": 33,
"collectionURI": "gateway.marvel.com/v1/public/characters/1009144/comics",
"items": [
{
"resourceURI": "gateway.marvel.com/v1/public/comics/36763",
"name": "Ant-Man & the Wasp (2010) #3"
},
{
"resourceURI": "gateway.marvel.com/v1/public/comics/17553",
"name": "Avengers (1998) #67"
}
]
}
}
]
}
I am using axios to fetch datas from an api inside a React component. I would like to access to the key items in my json response in order to setState but I can't.
export default class Hero extends React.Component {
constructor(props) {
super(props);
this.state = {
details : [],
comics :[]
};
}
componentDidMount() {
axios.get(infoUrl).then((res) => {
this.setState({details : res.data.data.results,
comics : res.data.data.results.results[6].items});
})
}
render() {
(<div>
</div>)
}
}
I can access to my state details but not the comics one.