-
Notifications
You must be signed in to change notification settings - Fork 164
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
connect setinterval with beginsampleData() #30
Comments
Can you show me exactly what you tried? |
@jrsquared here the modification i did, i want to make the http call each second and update the data
|
I had a bit of trouble with the same thing also. What I ended up having to do was the following componentDidMount () {
this.checkInitialRoute();
const self = this;
setInterval( () => { self.beginSampleData(self); }, 10000);
} I actually got that from @jolexa's fork. That said, I did make another incremental improvement to let the timer be cleaned up nicely. Otherwise, the timer runs forever even if you've navigated away from the React component. I created a global variable in trafficFlow.jsx that in my case I called componentDidMount () {
this.checkInitialRoute();
const self = this;
intervalHandle = setInterval( () => { self.beginSampleData(self); }, 10000);
} Then in componentWillUnmount componentWillUnmount () {
filterStore.removeChangeListener(this.filtersChanged);
clearInterval(intervalHandle);
} If you still have trouble I would check your |
GREAT information, this helped me a lot!!!! Thanks |
hi, so i want to introduce an interval each second in the trafficFlow.jsx, and connect this interval with beginSampleData() function, @jrsquared i tried to do that in the componentDidMount() function but it did not work, nothing change and there is no call of the beginSampleData each second, i would greatly appreciate some direction.
The text was updated successfully, but these errors were encountered: