useCallback

useCallback() sets up a memoized function that will only change and get recreated if one of the elements in the dependencies array (passed as the second argument) changes.