Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

-2 votes
1 answer
55 views

Is React Query more efficient compared to using hooks? [closed]

Is React Query more efficient compared to using useEffect and useState, given that these hooks are built-in and easy to use? If so, why choose React Query? Why is React Query more efficient than hooks ...
Abhishek Tyagi's user avatar
-2 votes
2 answers
126 views

Is learning useEffect() becoming less crucial for data fetching in React? Should newcomers prioritise learning React Query over useEffect()? [closed]

I've been working on a React component to fetch data from the GitHub API using useEffect. UPDATE There is loading, error and data handled all declared with the help of useState() and then rendering ...
Imran Rafiq Rather's user avatar
0 votes
2 answers
89 views

react-query: Detect first first fetch

I have two views when fetching: Initial one, when you see a component for the first time. When you changed filters inside this component, so header inside should be displayed and content at the ...
vljs's user avatar
  • 1,010
0 votes
0 answers
41 views

react query randomly refetch and rerender

I work with react query in my app it works fine, few days ago I saw a wierd issue, randomly api get refetched even that before I did not have this issue, when I debug I remark that sometimes after ...
Oussama Abouzid's user avatar
0 votes
1 answer
31 views

How to make sure to unmount component when URL param changes (but using same component) in NextJs with React-query?

I will make my example as simple as possible. I have userProfile component // UserProfie.tsx const UserProfile = ({id}) => { const {data: userData} = useUser(id); console.log(userData.id); // ...
Téwa's user avatar
  • 1,272
0 votes
2 answers
101 views

Using React hook & state to share data between components is not working as expected

Ok, I am misunderstanding something seriously. Here is reproduce link Basically, when a button is clicked from Child component, it should be reflected on the parent component which is App. And I ...
Téwa's user avatar
  • 1,272
-1 votes
1 answer
84 views

Why is my React Query request returning html instead of data?

I am trying to use a react query hook I made to make a request to mock data using json-server, but when the call is made it just returns an html document. I am trying to figure out what I did wrong, ...
Jon Jackson's user avatar
0 votes
1 answer
117 views

Why is my React Query query function being called when it should be disabled?

I want to conditionally set the parameters and fetching function called in a React Query function (useSpeciesCodes.js) in order to fetch from one of two API endpoints (fetching functions are ...
trash_clam's user avatar
0 votes
0 answers
104 views

Create a helper function to call react-query mutation

I am using graphql-codegen with react-query to generate mutations like these. const [createLogMutation, {}] = useCreateLogMutation({ variables: { data: { logType, message, task ...
Bishal Heuju's user avatar
0 votes
0 answers
57 views

React query not refreshing list results

I have a list query that returns an array of orders, that specifically have a value of acceptedAt: null. I then have a mutation that on click of a button updates the value of acceptedAt to a date. The ...
Jm3s's user avatar
  • 607
0 votes
0 answers
29 views

Update fetched data using a response from different api request using React Query

I have a data which is displayed in a table, this data is fetched using react query. I have table headers and when i click on these i want it to, fetch a different api request, to get ordered data ...
FriedBrain's user avatar
0 votes
1 answer
131 views

React-Query: useMutation's onSuccess to update chache but the cache seemed still

I wrote two React typescript projects with basically similar structures. They both used react-query to fetch data. The first code snippet is as below, and it worked as expected: export function ...
Oserjon's user avatar
0 votes
0 answers
276 views

React Query with custom hook

I'm building a web app fetching data from a strapi CMS. I made a custom hook with useQuery for data fetching. Strangely, when I use the hook, the parent component's style briefly switches from none to ...
Mhmd Backer Shehadi's user avatar
-1 votes
2 answers
814 views

What is a good method to set a state that will be changed based off a useQuery without the deprecated onSuccess call back?

I originally used the code below to set my components state, but I have seen online that It's a bad method to set a component's state as it can introduce bugs The callbacks on useQuery will be ...
Brandon's user avatar
0 votes
1 answer
170 views

problem with Hooks and Components: Error Invalid hook call

I'm having an issue getting a custom Hook working while using react Query. The code is fairly simple, as I'm just trying to debug the hook. I'm basically making an API call to return some data as ...
frustrated's user avatar

15 30 50 per page
1
2 3 4 5
16