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

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

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 }); }