0

I'm a little confused about javascript objects. I have a react app and I and I am trying to populate an input with some props. When I console log them out I am able to see them to a point.

This is the structure:

{ project: { frameRange: { start: 1000, stop: 1500 } }

When I log

console.log('this.props.project.frameRange', this.props.project.frameRange);

I see:

this.props.project.frameRange {end: "1048", start: "1000"}
end:"1048" start:"1000"

When I log

console.log('this.props.project.frameRange', this.props.project.frameRange.start);

I get:

TypeError: Cannot read property 'start' of undefined

What's going on here? I feel like I misunderstanding something fundamental about JS

ss_matches
  • 497
  • 2
  • 5
  • 20
  • You should see a little `i` next to the logged value that says “Value below was evaluated just now”. – Sebastian Simon Aug 20 '18 at 15:58
  • Are the single quotes around `'this.props.project.displayName'` intentional? This will output a string rather than your property. – Lewis Aug 20 '18 at 16:08
  • I saw the suggested post when I first started dealing with this, but I still don't know how to approach dealing with the situation. – ss_matches Aug 20 '18 at 16:30

0 Answers0