useMemo usage #1641
Unanswered
AjaxSolutions
asked this question in
Q&A
useMemo usage
#1641
Replies: 2 comments 2 replies
-
I'm not sure, but it really looks like we're executing a /edit: to clarify: I think |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think this should be changed to use useEffect, unless there is a very compelling reason to use useMemo. The function used by useMemo should be a pure function, but in this case the function is not pure. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is a lot of interesting code in React Query. This library is helpful and well done.
I'm curious why useMemo is used in the useHydrate hook as opposed to useEffect. What is the benefit?
useMemo is typically used to memoize the return value of a function, but the useMemo function is not returning any value.
React.useMemo(() => { if (state) { hydrate(queryClient, state, optionsRef.current) } }, [queryClient, state])
Beta Was this translation helpful? Give feedback.
All reactions