<aside> 💡 Original Post by Anand Kumar - Rights, credits and kudos for him

</aside>

React component lifecycle with Hook§

In previous post, I have explained how to convert a class component into functional component so that we can leverage the hooks. Here is the link to article:

React Hooks: Migrate class component to functional and use hooks

In this post, I will help you to understand how to get the same output that we used to achieve using component lifecycles with react hooks.

I’ll be covering following lifecycle methods:

Before we start, let’s get some understanding about following hooks:

useState

useState returns a stateful value and a function to update it.

Syntax:

useEffect