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 trial

JavaScript React Basics (2018) Understanding State Understanding State Review

Hello, I get stuck in this question?

Complete the code to display the value of a prop named time.

class Clock extends React.Component {
  render() {
    return (
      <span className="time"> {props.time}</span>    // what's the value of time?
    );
  }
}

5 Answers

Adam Beer
Adam Beer
11,314 Points

We don't know, but we saved the time value in the other file inside the state :) So now you can import the time from the other file.

Adam Beer
Adam Beer
11,314 Points

You are very close, just use the special keyword.

Anatolii Ryzhkov
Anatolii Ryzhkov
7,573 Points

Unfortunately, I still don't understand what the answer should be :(

The correct answer is {this.props.time}

thanks guys for helping

Adam Beer
Adam Beer
11,314 Points

Props keyword tell the compiler how the information come from another file.

Render Props

I user this.props.time but it not working????