python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Why use useMemo and not useCallback here?
So as i understand the difference between the two is that useCallback is used if a function or object or array is returned while useMemo when a primitive is returned.
But i was looking up debouncing (...
H.b
Votes: 0
Answers: 3
Cannot Read Property of undefined Object in dependencies array in useEffect or useCallback in React
I have a useCallback() method below to improve the performance. This will be same logic with useEffect()
If I have a dependency which is router.asPath, but sometimes the router is null, which may caus...

Xin
Votes: 0
Answers: 1
How do React refs behave inside useCallback?
I wouldn't expect the following React app to work properly, but it does. I'd expect the useCallback hook to capture and preserve the initial value of the ref. I understand that the ref couldn't be lis...
maja
Votes: 0
Answers: 1
React Native useEffect with async call results in stale state
I have a simplified react native app here that makes a network call and sets a flag when it loads. There is a button onPress handler which calls another method doSomething, both methods which are in a...
Doug
Votes: 0
Answers: 2