So here's some code
componentWillMount = () => {
var URL = 'http://localhost:8000/requests'
axios({
url: URL,
method: 'post',
data: {
message: 'getImages'
}
}).then(res => {
this.setState({currentImage: res.data.picsData[this.props.match.params.imageId]})
})
}
render() {
return (
<div className="image-component-wrapper">
<img src={'../content/' + this.state.currentImage.fileName} />
<div className="image-meta">
<p className='image-metadescription'{this.state.currentImage.description</p>
<p className='image-meta-author'>Uploaded by:
<i className='image-meta-author-name'>{this.state.currentImage.author}</i></p>
<div className='image-meta-tags'>
Tags:
{this.state.currentImage.tags.map(tag => <p>{tag}</p>)}
</div>
</div>
</div>
)
}
The image displays as it should. The two P tags and the I tag also but I can't get the array of tags to display at all. It gives me Uncaught TypeError: Cannot read property 'map' of undefined
They are contained in the same state object so I don't understand how it's possible. The array is there I'm sure!