Within the context of React/Meteor I'm running into some surprising difficulty extracting information from a nested Javascript Object.
My data structure looks like this (taken from inspection in chrome dev tools:
Object {
id: "138451",
name: "Attendant",
key: "Taiwan",
defaultAnimation: 2,
position: Object
{
latitude:0.5,
longitude: -0.14
}
Within my React ComponentWillRecieveProps I see the following behaviour
componentWillReceiveProps(nextProps){
console.log("its getting props");
console.log(nextProps.markers[0]) // this works
console.log(nextProps.markers[0].position) //so does this
console.log(nextProps.markers[0].position.longitude) //breaks
I also tried setting
var positionObject = nextProps.markers[0].position but interrogating this object also fails. Please highlight my Javascript noobish mistake.
Thanks!
nextProps.markers[0].position.longitude? Is itundefined?