When we want to call an api or any side effects which are not naturally the content of the DOM then we use useEffect
useEffect( callback , condition or controller);
call back is a function which is run when the condition is fulfilled , condition is the variable or the list of the variabels we define in an array
and the controller is the condition itself when we want to run the callback
This function (useEffect) runs one time by default when the page loaded
Then it is not a good practice to call an api very frequently so we can pass an empty array in place of the condition ;