NotePD Loader
Ideas Post

10 things learnt about react-query.

10 things learnt about react-query.
Preview

    1. React Query caches the api request output internally.

    Browser cache is aptly provided by react-query from the api.

    2. The automatic request to server is made on window focus event.

    3. If we can invalidate the already stored result for refetch or we can update the cache storage with newly received response using queryCache.

    4. useQuery, useMutation are ways to update the react-query.

    5. onSuccess, onError, onSettled few of the callbacks can be used to handle the response query response.

    6. Any async function be it fetch, axios, file fetch can be passed to react query for fetching.

    7. getQueryData, setQueryData, invalidateQueries can be used for optimized queryCache update.

    8. If you want to invoke query on click(common usecase), you can do it with passing a state var to useQuery and complete it.

    9. ReactQueryDevtools is a good way to get first hand experience on all query actions.

    10. prefetchQuery can be used to prefetch the information in background.

0 Like.0 Comment
Comment
Branch
Repost
Like
Profile
Profile
Profile
Chantelleand 3 more liked this
Comment
Branch
Like
0
94358
0
0
Comments (0)

No comments.