useCallBack:-
-------------------
The React useCallback Hook returns a memoized callback function.
This allows us to isolate resource-intensive functions so that they will not automatically run on every render.
The useCallback Hook only runs when one of its dependencies updates. This can improve performance.
If you find yourself keeping track of multiple pieces of state that rely on complex logic, useReducer may be useful.
The useCallback and useMemo Hooks are similar. The main difference is that useMemo returns a memoized value and useCallback returns a memoized function. You can learn more about useMemo in the useMemo
The React useCallback Hook returns a memoized callback function.
This allows us to isolate resource intensive functions so that they will not automatically run on every render.
The useCallback Hook only runs when one of its dependencies update. This can improve performance.
The useCallback and useMemo Hooks are similar. The main difference is that useMemo returns a memoized value and useCallback returns a memoized function. You can learn more about useMemo in the useMemo
- Every time a component re-renders, its functions get recreated. Because of this, the addTodo function has actually changed