Ideas Post
ProfileImg

10 things learnt about react-query.

10 things learnt about react-query.
Preview

    1. React Query caches the api request output internally.

    0

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

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

    0

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

    0

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

    0

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

    0

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

    0

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

    0

    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.

    0

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

    0

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

    0
0 Like.0 Comment
Comment
Branch
Repost
Like
Comment
Branch
Like
0
92330
0
0
Comments (0)

No comments.