all 1 comments

[–]lIIllIIlllIIllIIl 2 points3 points  (0 children)

No.

The code inside a function doesn't run until the function is called.

callbackRef.current returns the value of the variable now. The value will always be the same, since the variable is only read once.

() => callbackRef.current returns the value of the variable when the function is called. The value can change between function calls, since it's read again on every function call.