For example:
We have in the constructor the avatar data, inside the avatar there is thumb and inside the thumb the url. I just want to get the url. anyone has any hint to spare?
{avatar: {:thumb{:url}}}
constructor(props) {
super(props);
this.state = {
id: "",
avatar: "",
bio: "",
error: "",
}
}
fetched user data
async fetchUserId() {
let auth_token = await AsyncStorage.getItem(AUTH_TOKEN);
fetch("https://xxx.herokuapp.com/api/users/"+auth_token+"", {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
}).then((response) => response.json())
.then((json) => {
this.state.id = json.id
//this.state.url = json.avatar.thumb.url
})
.catch((error) => {
console.error(error);
});
}