Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrian Godden
7,598 PointsReact Basics, last quiz on the course "Understanding State"
I this quiz, I was certain the answer to the code completion for displaying a prop named time
would be this.props.time
(since Clock is a component Class). I thought I understood this, but the quiz tells me I'm incorrect. Can someone help me understand what I'm doing wrong for that answer?
Thanks! -Brian
3 Answers
Torben Korb
Front End Web Development Techdegree Graduate 91,433 PointsHi Brian,
you are absolutely right and this.props.time
is correct.... BUT you have to wrap this variable with curly braces to get the output in your component return value. If not you only output "this.props.time" as a simple string.
So the correct answer is {this.props.time}
Hope this help for understanding. Happy coding!
Rich Donnellan
Treehouse Moderator 27,708 PointsHey Brian!
You're not misunderstanding as this is exactly how you would access the props in a component class. Did you put the curly braces around your answer ({this.props.time}
)? I was able to submit the answer successfully.
Brian Godden
7,598 PointsAh... Yep, that's it. My eyes were just simply unable to see the difference. :)
Thank you!