Reputation: 57
Receiving an error TypeError: Undefined is not an object(evaluating 'this.props.track[this.state.selectedTrack]')
when trying run my simulator for iOS. I am building player. the error I am receiving when I start it up is below . and the code will be right under that for the player
any guidance will be appreciated.
import React, { Component } from 'react';
import {Player as PodCast} from './PodcastLayers/Player';
export const TRACKS = [
{
title: 'Stressed Out',
artist: 'Twenty One Pilots',
albumArtUrl: "http://36.media.tumblr.com/14e9a12cd4dca7a3c3c4fe178b607d27/tumblr_nlott6SmIh1ta3rfmo1_1280.jpg",
audioUrl: "http://russprince.com/hobbies/files/13%20Beethoven%20-%20Fur%20Elise.mp3",
},
];
export default class PodCastScreen extends React.Component {
render() {
return <PodCast tracks={TRACKS}/>
}
}
Upvotes: 0
Views: 557
Reputation: 826
Your second problem that you posted, you should import the class PodCastScreen
as import PodCastScreen from'./PodcastLayers/Player';
Upvotes: 0
Reputation: 305
2 state might be happening:
you are not passing "track" in your props
you are passing "track" with null or undefined value
Upvotes: 1