Questions tagged [react-apollo]

React Apollo allows you to fetch data from your GraphQL server and use it in building complex and reactive UIs using the React framework. React Apollo may be used in any context that React may be used. In the browser, in React Native, or in Node.js when you want to do server-side rendering.

react-apollo tag should be used for questions that are about the usage of the react-apollo ApolloClient container.

It should be included with the apollostack (and related) tags to clarify that this is the client wrapper being used.

It alleviates the need to use the , which should not be used, unless a person who knows nothing about react-apollo is likely to be able to answer the question.

Related tags

2335 questions
0
votes
0 answers

Const InitialValue Updating on updating thirdPartyRequestVar

TextChangeHandler function I am trying to update thirdPartyRequestVar with respect to index and properties, but updating the thirdPartyRequestVar the initialValue are also getting updated Const initialValue: RequestThirdParty = { businessName:…
0
votes
0 answers

I want onCompleted of useLazyQuery is called only once after successfull query

I want onCompleted of useLazyQuery is called only once after successfull query but it is being called multiple times I want onCompleted of useLazyQuery to be called once
0
votes
0 answers

useLazyQuery variable is not updating with the latest input value

The console log is returning one value behind the real value (e.target.value). Any ideas why? Thanks For eg. if i have "test" in the input the value fetched is tes const [getDataLazy, {data}] = useLazyQuery(getData) const handleInputValue = (e:…
0
votes
0 answers

UseQuery on change using e.target.value

I have a graphql query and I need to update and call getData on every input change. I've tried using useState but the state does not update in time. The only thing I can imagine to fix this is using e.target.value as the value for the variable but I…
0
votes
1 answer

Apollo GraphQL react client: subscription

I was trying to make a little demo with GraphQL subscriptions and GraphQL Apollo client. I already have my GraphQL API, but when I try to use Apollo client, it looks like it doesn't complete the websocket subscribe step: import React from…
shinjidev
  • 383
  • 1
  • 6
  • 21
0
votes
0 answers

Apollo client read last operation data from cache

I have to components. A list and a modal to update list items. In the list component I get data from server with useQuery hook const { data } = useQuery(LIST, { variables: ...complexVariables }) And the LIST query is something like this: const LIST…
Amin
  • 615
  • 7
  • 16
0
votes
0 answers

How to test a apollo grapgql useQuery which exist in context in a react component

I have a react component which consumes graphQl APIs to get some data. those APIs live within context. here is what I have within my component: const context = useContext(someContext); const { usePostUsers, useGetUsers } = context; …
0
votes
1 answer

React + Apollo / GraphQL: Folder structure for colocation of custom queries?

I am no GraphQL expert so looking for some insights. I have an app that looks like this: src/ components/ FooPage BarPage BazPage All 3 pages will make the same queries but with different fields // FooPage const GET_DOGS_1 = gql` …
bigpotato
  • 26,262
  • 56
  • 178
  • 334
0
votes
2 answers

Cannot Get Apollo addItem Mutation to work on the client keep getting 400 error

All I want to do is add an item to the items array in my Cart object. What I am trying to do is simply execute my backend addItem mutation. After that I want to manually update the cache, but for now I am just re-fetching the query because I am…
Wayne
  • 660
  • 6
  • 16
0
votes
0 answers

i need a package.json file for a project that works with react, graphql and apollo-client

hi i have a problem with a task that required from me that i should do a simple store with 3 pages that uses graphql and apollo client with react but with class components not functional and hooks so if anyone can help me with that because i can't…
0
votes
0 answers

useMutation hook error not corresponding with thrown error message on the server

useMutation hook error not corresponding with the thrown error message on the server The client error link log is correct [GraphQL error]: Message: Authentication required., Location: undefined, Path: undefined client code error logging import {…
0
votes
1 answer

How to make inputs more DRY in React Apollo?

How can I reuse variable arguments in GQL Apollo React? e.g. in a situation where the inputs are the same but we need different data corresponding for a different situation. Is there a way to define this inside or outside of this query call? const…
darkace
  • 838
  • 1
  • 15
  • 27
0
votes
0 answers

Apollo writing to cache fails

Im writing tests with vitest using react-testing-library to a React component using Apollo Mock Provider. I have a mutation in my code, which I'm mocking (works just fine). The mutation has an update function(that fails). The update function reads…
0
votes
1 answer

Getting Invariant Violation : invariant violation 47 on mutation query in appolo graphql

I am using a mutation query to take the input from user and update it in database but while updating it is throwing this error invariant violation which I am not able to understand, In mutation I have four objects with min and max value that is…
0
votes
1 answer

How to implement UseMutation inside React native?

I'm trying to implement my CreatUser Service in my App but it's not working. I'm using NestJS for the backend with GraphQl for the API's and React Native in the FrontEnd with appolo Server. I always get this 2 errors: -POST…
Nezih
  • 9
  • 1
  • 3
1 2 3
99
100