Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time doesnt update #127

Closed
mortenbirkelund opened this issue May 9, 2019 · 3 comments
Closed

Time doesnt update #127

mortenbirkelund opened this issue May 9, 2019 · 3 comments
Assignees
Labels

Comments

@mortenbirkelund
Copy link
Contributor

After playing around with this dashboard for some time, I dont understand how the functionality to update the components works. By using the setTimeout() function, the code is only updated 1 time. Is this on purpose. If i replace the setTimeout() with the setInterval() then it works.

 componentDidMount () {
    const { interval } = this.props
    this.timeout = setInterval(() => this.setState({ date: new Date() }), interval)
  }

Anybody who can explain to me how the setTimeout should be able of updating the components multiple times?

@mortenbirkelund
Copy link
Contributor Author

The setInterval works, and can be cleared in the componentWillUnmount()

@danielbayerlein If you agree, then let me know and I will create a pull request for it.

@marco-streng
Copy link
Collaborator

@mortenbirkelund you're welcome to create the PR! 👍🏼

@danielbayerlein
Copy link
Owner

Thank you @mortenbirkelund!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants