Closed stephencastaneda closed 4 years ago
When I click on a song, the singleSong view should be displayed.
WHEN I click on a song on the Song page THEN I should be taken to a singleSong view
*in SingleSong.js set state to a song and resources which should be an empty object
SingleSong.js
state
song
resources
use componentDidMount()
componentDidMount()
get the { songId } from this.props.match.params
{ songId }
this.props.match.params
then call getSingleSong and pass in songId from songsData.js
getSingleSong
songId
songsData.js
it should also call getResourcesBySongId from resourcesData.js
getResourcesBySongId
resourcesData.js
.then should return a response and set the song and resource objects in this.setState to response.data
.then
response
this.setState
response.data
.catch should console unable to get single song
.catch
render() should get the { song } and { resources } from this.state
render()
{ song }
{ resources }
this.state
and { songId } from this.props.match.params
the return should build a card that displays all of the object keys from the song and resources
return
User Story
When I click on a song, the singleSong view should be displayed.
AC
WHEN I click on a song on the Song page THEN I should be taken to a singleSong view
DevNotes
*in
SingleSong.js
setstate
to asong
andresources
which should be an empty objectuse
componentDidMount()
get the
{ songId }
fromthis.props.match.params
then call
getSingleSong
and pass insongId
fromsongsData.js
it should also call
getResourcesBySongId
fromresourcesData.js
.then
should return aresponse
and set the song and resource objects inthis.setState
toresponse.data
.catch
should console unable to get single songrender()
should get the{ song }
and{ resources }
fromthis.state
and
{ songId }
fromthis.props.match.params
the
return
should build a card that displays all of the object keys from the song and resourcesDev Notes