I realized that
useEffect(() => {
});
without the second argument of the array will cause the function to run every single time.
However, since we are concerned with some data or ID to display (the React docs of setting the document's title) or data to fetch, in what real practical example would we actually want it to always run? I can only think of cases where we only want it to run once, or if we depend on something, such as id
or some value, but never "always run". What is just one real use so that we can see that it is actually practical? (and so that we can relate this feature with an actually practical use case in the world). What is one real world example of use? I don't think this is opinion based.