Call function in useEffect when value changes, but not when component mounts
When component mounts
useEffect hook is called.
This is fine in most cases, but if you need to track value changes
you will need to implement something like this to prevent
useEffect call on mount:
use-did-update uses the same logic: