These methods are called in the following order when an instance of a component is created and inserted into the DOM:
- constructor() ⬅
- render()
- componentDidMount()
- We use it when we want to pass
propsto the class component. - By default it must contain
superkeyword, that receivespropsas argument fromconstructor. - If we are setting the
stateinconstructorwe have to usethiskeyword. - We can use it to
bind()value ofthisto the methods. - If we are not initializing the
statefrompropsand we are not binding methods, we don’t need to use/write theconstructor(){ ... }block in our React component.