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 trialKyle Rand
4,819 PointsWhy isn't the solution {this.state.time}?
What am I missing? It's in a state component so shouldn't it be using that code?
Complete the code to display the value of a prop named time.
class Clock extends React.Component {
render() {
return (
<span className="time">{this.state.time}</span>
);
}
}
1 Answer
Eduardo Valencia
12,444 Pointstime
is not part of the state since the question states that it is a prop.. State is different from props because it changes over time, while props does not. They are accessed differently.
Kyle Rand
4,819 PointsKyle Rand
4,819 PointsOh, that makes sense. Thank you