I stumbled on this code in react.js tutorial
componentDidMount() {
this.timerID = setInterval(() => this.tick(),1000);
}
(This componentDidMount() is inside React.Component extension class)
The question is, why I need to bind with () => first?
while if outside class I can just do
setInterval(tick,1000)
EDIT: in my defense of mark as duplicate question, the provided link of the duplicate question revolves around 'this' keyword. While what I really asked is why should I use arrow function / binding inside the class. Although the answer point to how to use 'this' keyword, the origin and the question is absolutely unique.