CustomHookWrapper, useMemo or useCallback to improve React-Native performance #2625
Unanswered
Metroidaron
asked this question in
Q&A
Replies: 1 comment
-
have you read: https://react-query.tanstack.com/community/tkdodos-blog#3-react-query-render-optimizations also, you don’t need an effect or state at all, you can just pass to
that violates the rules of hooks and wouldn’t achieve anything |
Beta Was this translation helpful? Give feedback.
0 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.
-
Hello,
I am currently using React-Query in React-Native and it's wrapped inside a custom hook. Performance is lacking, especially when the user first logs in and many fetches are running at the same time, but I'm afraid my implementation may be rendering a lot un-necessarily... I want to improve performance by using useMemo or useCallback to reduce how often the UI tries to update down stream...
This is a dumbed down code sample to give you a feeling of how my code is implemented, since I'm wrapping the useQuery hook in my own custom hook...
Feed.tsx
useMyFeed.ts
I haven't had to use useMemo or useCallback before and am not sure where I should focus on implementing them, I have a basic understanding of what they do (Returning the same value across re-renders if the dependencies haven't changed)... but I'm unsure and could not find an answer online if it is acceptable to wrap useQuery in a callback?
Or should I be substituting useEffect with something like useMemo?
Beta Was this translation helpful? Give feedback.
All reactions