const increment = useCallback(() => setCount((x) => x + 1), [])
return { count, increment }
}
What happens if i cut out useCallback?
Nothing! Anyway, it has no sense to use useCallback in this case!
It's used in the readme of react-hooks-testig-library
Обсуждают сегодня