react-query Questions

4

Solved

I've been dealing for a while with this problem and still can't tackle it. I'm using React-query as a server state management library and I'm trying to get my UI state synchronized with my server s...
Cedillo asked 18/10, 2022 at 16:47

4

Solved

Why should I use QueryClient.prefetchQuery instead of useQuery for caching in React-Query? I don't see any valuable use case. If I want to prefetch, I could just use useQuery when the app is loaded...

2

Solved

Being that react-query is heavily based on the declarative approach, the error handling I see in all examples looks something like this: function Todos() { const { isLoading, isError, data, error ...
Underpay asked 19/3, 2022 at 9:52

3

Solved

I'm using react-query v3.13 to fetch data from API. What I want to do is to fetch API regularly from a certain point (for example, when clicking the start button), not from the time of calling useQ...
Petard asked 23/3, 2021 at 3:50

5

Solved

I am using React Query to fetch data from an API in a React app. I want to implement debounce for better performance, but I'm having trouble getting it to work with useQuery. When I try to wrap my ...
Snowinsummer asked 17/4, 2023 at 0:35

6

Solved

I've started playing with React-Query and it works great if I only need to fetch data from a single collection in my database. However, I'm struggling to find a good way to query multiple collectio...
Kamalakamaria asked 1/3, 2021 at 18:54

3

Solved

I have the following definition of useQuery that i use in a couple of React components: useQuery("myStuff", getMyStuffQuery().queryFn); Where getMyStuffQuery looks like this: export cons...
Harakiri asked 5/12, 2021 at 21:48

2

I tried to implement an infinite scroll with my react.js project using Infinite Queries in react-query and react-virtual. But Infinite query is supporting with the cursor and the page. and my API i...
Viehmann asked 29/11, 2020 at 7:14

22

I'm trying to invalidate queries every times users press button "likes" to refresh all queries but without success so far despite following the docs. I have a component that get data : c...
Curassow asked 29/7, 2021 at 14:40

5

Solved

I'm new with React Query, and I have a question, I've being looking on the documentation but I can't find how should I access the data that is already fetched with useQuery() from another component...
Cabaret asked 11/7, 2021 at 12:49

4

Solved

As these are downloadable from npm with their names with different sizes. In which scenarios we must downloads tanstack react query and for which react-query.
Incursive asked 9/9, 2022 at 15:8

18

I was trying React Query and got this at the start of my React app. import React from 'react' import { useQuery } from "react-query"; const fetchPanets = async () => { const result...
Lissner asked 6/1, 2021 at 4:25

1

I'm getting this error when testing a component that uses react query custom hook: " No QueryClient set, use QueryClientProvider to set one " this is my hook: export default () => { c...

3

Solved

Trying to find an answer regarding react-query. What's the difference between useQuery and useMutation? From what i understand useQuery's are dependent calls. useMutation are for posts that require...
Robledo asked 5/11, 2020 at 16:8

2

I'm trying to follow a series on using Pocketbase with NextJS, but I'm following a video which uses create-react-app, so I'm needing to make some changes along the way. It's been fun, but I'm stuck...
Unless asked 30/9, 2023 at 4:14

3

I have api call that looks like const getMutationService = () => { return { createMeme: async ( _private: string, templateId: string, file: Blob, memeText?: string, title?: string, tags?...
Jacintha asked 11/7, 2022 at 5:15

12

I am new to this react-query library. I know that when I want to fetch data, with this library I can do something like this: const fetchData = async()=>{...} // it starts fetching data from ...
Damnify asked 12/6, 2020 at 8:43

1

I have this simple app where makes a call to an API. I am using react-query to make the fetch and also to cache the data. However, even though the function is wrapped in React.memo, useQuery causes...
Philcox asked 25/6, 2020 at 11:40

5

Solved

I have a requirement to keep fetching data until a condition is met I can set up the fetch on an interval with the snippet below but I can't figure out how to stop the fetchData when needed. Is thi...
Bozen asked 18/2, 2021 at 16:21

1

In React Query with TypeScript, I have this getRecommendations hook, that I want to only send the latestrecs (ill probably have another hook for watchlist etc). I get an error in the queryKey stati...
Beaubeauchamp asked 9/5, 2023 at 19:33

1

I have built a ReactJS application using Vite, and I am testing my application using Vitest. I make heavy usage of react-query within my application. For mocking network requests during testing, I ...
Usually asked 20/3, 2023 at 20:34

7

Solved

As the title suggests, I am new to using useQuery and the associated libraries, I am trying to use it to fetch data and then populates a list of fields that I have created However when I run it I g...
Capias asked 11/12, 2021 at 23:33

4

Solved

I am using react-query to call an API. The call works well and is performed each time a query value is updated in an input field. Unfortunately, it also triggers an API call even when the query is ...
Noto asked 3/6, 2020 at 15:10

3

I'm learning react query and i'm trying to post data with it. I'm able to fetch data with react-query, but I can't do the same posting data. My question is if it's possible to post data with react-...
Rhododendron asked 26/1, 2023 at 10:25

3

Ok, I'n new to reactQuery and cant wrap my head around this. useUpdateUserSettings is a import from a custom hook. I have a page that calls this function: const updateUserSettingsMutation = useUpd...
Menken asked 4/3, 2022 at 10:28

© 2022 - 2024 — McMap. All rights reserved.