Help me to call this function please. I want to get category count and category name from Wordpress API
CatName(item){
fetch('http://anbaetv.ma/wp-json/wp/v2/categories/'+item.categories)
.then((response) => response.json())
.then((json) => {
this.setState({
jsonData: json.count,
});
})
.catch((error) => {
console.error(error);
});
}
renderItem = ({item}) => {
return(
<TouchableOpacity onPress={() => this._onPress(item)}>
<View style={{flex:1, flexDirection: 'row', marginBottom: 2,}}>
<Image
style={{ width:100, height:80, margin:5}}
source={{uri: item.better_featured_image ?
item.better_featured_image.media_details.sizes.thumbnail.source_url : 'https://via.placeholder.com/150/0000FF/808080?Text=NotFound'}}
/>
<View style={{flex:1, justifyContent:"center",marginLeft:5}}>
<Text style={{fontSize: 18, marginBottom: 15}}>{item.title.rendered}</Text>
<Text style={{fontSize: 18, marginBottom: 15,color:"red"}}>{this.CatName(item)}</Text>
</View>
</View>
</TouchableOpacity>
);
}
