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 trialdisheng wang
5,422 PointsQuestion about the arguments passing in to the setInterval method
From the componeDidMount life cycle , code below:
componentDidMount() {
this.intervalID = setInterval(() => this.tick(), 100);
console.log(this);
}
here we pass ()=>this.tick()
to the setInterval method. However, I am a bit confuse what is the different between we pass this.tick
instead of () => this.tick()
? i think they doing the same thing right? or is it just if we use arrow function calling the this.tick so I can pass the argument to the tick method? thanks