
In this two-part article series, I will be covering the lifecycle methods of class components in ReactJS. Almost everything in this world follows some sort of cycle. Take for instance trees, they are born, grow, and then die. React’s components are no different. They are created – mounted on the DOM, grow by updating, and then cease to exist – unmount on DOM. This is called a component’s lifecycle. Depending on the phase of a component’s life there are different lifecycle methods that React provides. Lifecycle methods are special methods that automatically get called as our component achieves certain milestones. I liken these methods to special event handlers, like the ones you have when listening to load events on an HTML page. The lifecycle is broken down into four core stages: Initialization, Mounting, Updating, and Unmounting. In this first article, I will be covering Initialization and Mounting.
[Read More]