Closed throwpigeyaway closed 5 years ago
https://imgur.com/a/B7A8ePk screen shot
I might be wrong, but I think you need to remove:
let hero = photos[active].value
from the render method in Carousel.js
Instead, use diffcheck and make sure your Pet.js file matches what bholt has. I think you might be including code from the Pet.js file in your Carousel.js
You'll have to refer to the final code from this step: https://btholt.github.io/complete-intro-to-react-v4/async-and-events-in-react
Final code for the Carousel: https://github.com/btholt/complete-intro-to-react-v4/commit/89678fe3f663be06f80e93370942592c03f3f5db
TypeError: Cannot read property 'value' of undefined
`class Carousel extends React.Component { state = { photos: [], active: 0 }; static getDerivedStateFromProps({ media }) { let photos = []; if (media && media.photos && media.photos.photo) { photos = media.photos.photo.filter(photo => photo["@size"] === "pn"); }
} handleIndexClick = event => { this.setState({ active: +event.target.dataset.index }); };`
Photos and active are defined already from what i know.
(anonymous function) src/Details.js:30
The details page works fine before the Carousel import. I copied the git file for Carousel, and it still doesn't work.