Skip to content
Discussion options

You must be logged in to vote

We use it when we need a stable reference internally to a callback passed by the user which we can't guarantee has been memoized.

I guess the function of this hooks is used to simulate the useEvent that react has not yet available?

We created this long before that RFC, but I guess that is what useEvent is, I haven't looked at the RFC but seems similar.

my understanding is that the reason to use useLayoutEffect is to get the updated value at the render stage, while useEffect is executed asynchronously after the render stage, so using useEffect is not able to get the updated value in the render stage, so is useCallbackRef a problem in this particular case? Or is this special scenario int…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shervinchen
Comment options

Answer selected by shervinchen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants