Hi all , Many people started using react-hooks including me . The most common issue people face while using hook is infinite loop
To avoid such infinite loop all are aware of using the conditions in the array brackets like
Whenever the state value changes the useEffect will be rendered again
In the above image I'm having the state variable of the type array which consists of multiple objects , when the changes are made react checks for the condition inside the useEffect, whether to re-render the useEffect or not.
Here is the problem since we didn't mention the particular value inside the array of useEffect , so whenever the value inside the state changes react doesn't find any difference and the useEffect is not rendered again even if I change the object value name:'full stack developer'
This happens because react can't predict the value changed inside the particular object inside the array.
*Note: useEffect will identify the change if any new object is added to the array *
Thanks for reading!
Happy Coding !