When does the constructor method get called?


In the context of this exercise, when does the constructor method get called?


The constructor method is invoked when a new component instance is created and runs before the entire component’s lifecycle starts. It runs before componentWillMount, which is the start of the mounting phase of the component.


I haven’t seen creating instances of the component classes in the codecademy exercies, its always been render the class component, then when are they being called ? Please explain.

its explained here:


which contains the following explanation: These methods are called in the following order when an instance of a component is being created and inserted into the DOM:

i wouldn’t call it a problem, but react does a lot of stuff under the hood (under water if you like), including creating the class instance.

if you want to learn more about classes and creating class instances, i would do this in pure JS to improve your understanding of classes, so you can better “see” how react might do this.