Open Velenir opened 4 years ago
Currently toggle function is created anew on each render. If later passed as a prop to a component it can cause unnecessary rerenders.
toggle
Memoizing toggle with useCallback would avoid that
useCallback
Currently
toggle
function is created anew on each render. If later passed as a prop to a component it can cause unnecessary rerenders.Memoizing
toggle
withuseCallback
would avoid that