> I’m still not exactly sure what the difference between useMemo and useCallback is
const useCallback = (fn, deps) => useMemo(() => fn, deps);
That's it. That's all it is. `useCallback` is a shorthand for `useMemo`, when you want to memo a function definition.Example:
const handleButtonClick = useCallback((event) => {
event.preventDefault();
window.alert(`Hello, ${name}!`)
}, [name])
is just shorthand for const handleButtonClick = useMemo(() => (event) => {
event.preventDefault();
window.alert(`Hello, ${name}!`)
}, [name])