'Why does useEffect not accept pre-defined functions as its first argument?

useEffect(someFunction(), [])

Didn't work

useEffect(() => {
    someFunction();
  }, [])

Worked

In this code, why does useEffect use function expressions as the first argument when the someFunction is already a function? I tried directly using someFunction as the first argument without the function expression, but it didn't work



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source