Can you explain "this.intervals=null" in the App.js file? Exercise 4/7


#1

I was under the impression that the only things that need to be declared in a constructor are this.state and binding methods. So i can’t understand why this.intervals has been declared here. Is it arbitrarily declared or is “intervals” a pre-defined object in React.components with certain properties that can be called on?


#2

where did you get this impression? Do you understand what the constructor does?

interval is part of Javascript. But declaring the interval in the constructor gives us a way to verify that the timer hasn’t been started yet.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.