useEffect is a React Hook that lets you synchronize a component with an external system.
It is used to perform side effects in functional components.
Side effects include things like data fetching, DOM manipulation, and setting up subscriptions with browser apis.
It runs after the component has rendered and can be used to manage asynchronous operations or respond to changes in props or state.
componentDidMount: useEffect will always be called on the first mount.
componentDidUpdate: By providing dependency values in dependency array
componentDidUnmount: by returning a cleanup function.