Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

David Austin
David Austin
1,217 Points

In the function below, update an isRunning state to true. (In React)

This is part of the State and Events Review Quiz. I do not understand how to go about this. The only way I have seen something similar is like "time: 0". Please point me in the right direction!

startTimer = () => { this.({ : }); }

2 Answers

Randy Layne
seal-mask
MOD
.a{fill-rule:evenodd;}techdegree seal-36
Randy Layne
Treehouse Moderator

Hi David, so the video related to this would be https://teamtreehouse.com/library/updating-state-2. In it Guil uses the setState method to update the current state of a property. Inside of the { and } you can use regular Object notation to set the property you want, in this case isRunning to the value you want: true

Ezra Siton
Ezra Siton
12,644 Points

Clue:

startTimer = () => {
  this.setState({ _______ : true });
}

startTimer = () => { this.setState({ isRunning: true }); }