DEV Community

Discussion on: Updated with Hooks How To GraphQL with React Apollo

Collapse
 
ajaypatel profile image
FoodBite

When i try to console log data from useQuery it prints in console 3 times, and causes re render , why do you think that's happening?

Collapse
 
brittneypostma profile image
Brittney Postma

It could be that the query is being used in the ListLinks component and in CreateLink component to check for updates. I had to do this to make the link show on url redirect without hard refreshing the browser. There is probably a more efficient way to do it with a useRef or useMemo, but I just wanted to get it working.