When reading the the official Hooks guide, it mentioned that every value referenced inside the effect function should also appear in the dependencies array.