Component LifeCycle methods
Lifecycle methods in React (Class-based Components)

Hello, I am a WEB and MOBILE app developer. I like to write about Javascript, React, NextJS, React Native and all the good stuff.
Search for a command to run...
Lifecycle methods in React (Class-based Components)

Hello, I am a WEB and MOBILE app developer. I like to write about Javascript, React, NextJS, React Native and all the good stuff.
No comments yet. Be the first to comment.
extending the codebase to generate web compatible build for desktops

Auth solution for React native apps

Bringing a project to life needs a clear plan. You start by thinking about the features you want and get into the nitty-gritty details. When you have a clear picture, implementing the project becomes much smoother. A big part of this involves figurin...

Search, Publish and Share your hashnode blogs

includes Architecture, internal tooling and comparison with web practices

In react, every component goes through a process called component lifecycle. This component lifecycle explains the interactivity of data to UI on the page.
You can follow this diagram to visualize the lifecycle of a component.

Use Slider to see the code
Just like in the Mounting cycle, a bunch of lifecycle hooks are called in the update cycle, every single time we want to re-render.
In update cycle, firstly shouldComponentUpdate() is invoked, then render() and only then componentDidUpdate().
This is an important stage of the component lifecycle. It is where cleanup is performed after the component is unmounted. The reason to clean up after unmounting any timers, background calls is to optimize the application for the user's intended experience. An application must compute the result with full memory usage designated to the task at hand, not lag due to past actions. Pending requests must get eliminated as soon as the interaction with the specific component is over.
If we do not unmount the component, background calls, functioning will keep on running and stacking up the memory. See thi example. Check the console and press the toggle button. %[]
To solve the problem we must register an unmount stage after the use of the component is done. As it will clear the space and will optimize the whole application
Error Handling: Here You can continue learning about lifecycle hooks for functional Component