This is possible, but the linter will tell you that there is a missing dependency, in this case getCocktails(). useEffect is depending on external values that may change, when you set the dependencies as an empty array the effect will run just once when the component mounts.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In an example from 2nd technique, wouldn't it make more sense to just use empty array as useEffect dependency?
This is possible, but the linter will tell you that there is a missing dependency, in this case getCocktails(). useEffect is depending on external values that may change, when you set the dependencies as an empty array the effect will run just once when the component mounts.