🤑 Join the Treehouse affiliate program and earn 25% recurring commission!

New No-Code Track! 🚀start learning today!

🌟 Dreaming of a bright future? 🎓 Ask about the Treehouse Scholarship program! 🚀

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

  • Treehouse Logo
  • Plans
    Chevron
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
  • Library
    Chevron
    • All Courses
    • Tracks
    • College Credit
  • Techdegree
    Chevron
    • Overview
    • Front End Development
    • Full Stack JavaScript
    • Data Analysis
    • UX Design
    • Python
  • Community
    Chevron
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
  • Resources
    Chevron
    • Career Toolbox
    • CodeForward
    • Free Treehouse Near Me
    • Jobs
    • Blog
    • Support
    • About
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks College Credit
  • Overview Front End Web Development Full Stack JavaScript Python Development Data Analysis UX Design
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Career Toolbox CodeForward Free Treehouse Near Me Jobs Blog Support About
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • Android
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
  • jun cheng wong
    jun cheng wong
    17,021 Points

    Need further explaination

    Posted June 5, 2021 6:53am by jun cheng wong
    jun cheng wong
    17,021 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Eduardo Osorio
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Eduardo Osorio
    Full Stack JavaScript Techdegree Graduate 20,847 Points

    Why is he calling this.tick() inside set interval instead of just passing it as a callback ie: this.tick ?

    Posted March 12, 2021 9:50pm by Eduardo Osorio
    .a{fill-rule:evenodd;}techdegree seal-36
    Eduardo Osorio
    Full Stack JavaScript Techdegree Graduate 20,847 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Shung Chen
    Shung Chen
    6,526 Points

    Confusion in getting true elapsedTime

    Posted September 25, 2020 5:34pm by Shung Chen
    Shung Chen
    6,526 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    0 Answers

  • Yanhan Liu
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Yanhan Liu
    Front End Web Development Techdegree Graduate 16,389 Points

    React | Why add () when using prevState in setState()?

    Posted September 25, 2020 4:28pm by Yanhan Liu
    .a{fill-rule:evenodd;}techdegree seal-36
    Yanhan Liu
    Front End Web Development Techdegree Graduate 16,389 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Begana Choi
    PLUS
    Begana Choi
    Courses Plus Student 13,126 Points

    why don't we use prevState in tick function for ( now - this.state.previousTime )?

    Posted June 14, 2020 10:55am by Begana Choi
    Begana Choi
    Courses Plus Student 13,126 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • virus200
    virus200
    6,583 Points

    Interval/Timeout throttling for timer?

    Posted March 17, 2020 3:31pm by virus200
    virus200
    6,583 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    0 Answers

  • onesoftwareengineer
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    onesoftwareengineer
    Full Stack JavaScript Techdegree Graduate 19,767 Points

    Might the asynchronous setState() method be run before the next segment of synchronous code in some instances ?

    Posted January 27, 2020 12:09pm by onesoftwareengineer
    .a{fill-rule:evenodd;}techdegree seal-36
    onesoftwareengineer
    Full Stack JavaScript Techdegree Graduate 19,767 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Herman Morales
    Herman Morales
    8,831 Points

    Why did you use the this.intervalID instead a only a setInterval and where is the intervalID property? never wasdeclared

    Posted November 6, 2019 1:58am by Herman Morales
    Herman Morales
    8,831 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    0 Answers

  • Ankit Upadhyay
    Ankit Upadhyay
    556 Points

    Update the Stopwatch

    Posted August 13, 2019 1:49pm by Ankit Upadhyay
    Ankit Upadhyay
    556 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    0 Answers

  • vamosrope14
    vamosrope14
    14,932 Points

    Can someone please explain the concept behind elapsedTime and previousTime?

    Posted August 13, 2019 1:17am by vamosrope14
    vamosrope14
    14,932 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Luke Markham
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Luke Markham
    Front End Web Development Techdegree Graduate 17,289 Points

    timer reset with first "console.log('starting')"

    Posted June 22, 2019 2:07am by Luke Markham
    .a{fill-rule:evenodd;}techdegree seal-36
    Luke Markham
    Front End Web Development Techdegree Graduate 17,289 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • ewenearle
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    ewenearle
    Full Stack JavaScript Techdegree Graduate 18,744 Points

    setInterval() inside componentDidMount()

    Posted March 5, 2019 4:58pm by ewenearle
    .a{fill-rule:evenodd;}techdegree seal-36
    ewenearle
    Full Stack JavaScript Techdegree Graduate 18,744 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Brian Hoang
    Brian Hoang
    11,515 Points

    setState in handleStopwatch()

    Posted November 13, 2018 1:37pm by Brian Hoang
    Brian Hoang
    11,515 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    1 Answer

  • Saud Tauqeer
    PLUS
    Saud Tauqeer
    Courses Plus Student 8,099 Points

    Having trouble understanding logic.

    Posted October 11, 2018 1:22am by Saud Tauqeer
    Saud Tauqeer
    Courses Plus Student 8,099 Points
    • JavaScript
    • React Components (2018)
    • Stateful Components and Lifecycle Methods
    • Update the Stopwatch State with componentDidMount()

    2 Answers

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

    Treehouse

  • About
  • Blog
  • Careers
  • Community
  • Stories
  • Shop
  • Contact
  • Gift Card

See Full Catalogue

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
  • Python Development
  • Data Analysis
  • UX Design

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
  • ...see more

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
  • ...see more

Explore

  • Plans
  • Affiliates
  • Perks
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
Terms & Conditions | Privacy

© 2025 Treehouse Island, Inc.