Unmounting means a component is being removed from the screen

Side effects

Side effects are operations that interact with the outside world or have effects beyond the component's rendering. Examples include:

useEffect lets your component do something after it shows up on the screen.

This “something” is often:

Problem in running side effects in React components

If you try to introduce side effects directly in the rendering logic of a component (in the return statement or before it), React would run that code every time the component renders. This can lead to: