What else does the React.Component class provide?


In the context of this exercise, what else does the React.Component class provide?


The React.Component class provides several methods in addition to render(), some of which are automatically invoked through the lifecycle of the component.

The constructor() method is invoked by the component before it is added to the DOM. This is usually used to run code to set up the component such as initializing some state and binding methods to the component.

The class also provides a componentDidMount() method which is run right after the component is inserted into the DOM tree, and is invoked only one time.

Another method is componentDidUpdate(), which runs immediately after any updates to the component occurs. This is typically used for code such as network requests which should be run if any updates occur to the component.


Is React.Component method a Super Class ? that we extends it with name of MyComponentClass as a child calss ? I can see render() as alternative to constructor method while dealing with supercalss and class why it is named render instead of constructor? , what is this ? I’m confused trying to relate it . why render() takes no arguments and why we didn’t make an object out of class we made with superClass React.component ? how return works here ?


If ‘render’ method is already defined inside the React.Component then why do we have to define it in the class which inherits from it?

I think, it’s not a definition, but a call??