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

2126 questions
0
votes
1 answer

Recieved this error: Error: Too many re-renders. React limits the number of renders to prevent an infinite loop

I've a stepper form, that insert data using GraphQL/Apollo and React, of two different places. Here are the code: export function ProjectStep({classes, nextStep}) { const {loading, error, data} = useUserQuery(); const…
Baptista
  • 115
  • 2
  • 10
0
votes
2 answers

Why does functional component render twice?

I got a component that fetches data from a GraphQL route using Apollo. When I load the page, it console logs the data twice. This is the component : const LAUNCHES_QUERY = gql` query LaunchesQuery { launches { flight_number …
apollo24
  • 243
  • 1
  • 13
0
votes
1 answer

Graphql query executed only after refresh

I'm using React and Graphql and Apollo. My index.js is as follows: const client = new ApolloClient({ uri: GRAPHQL_URL, fetchOptions: { credentials: 'include' }, request: (operation) => { const token =…
Boky
  • 8,942
  • 19
  • 69
  • 134
0
votes
1 answer

Problem querying GraphQL with Gatsby-Apollo-Postgres setup: "Network error: failed to fetch" [apollo]

I'm using Gatsby, Apollo, and a local Postgres server. I want to connect Apollo to my local postgres db to serve data to Gatsby dynamically via GraphQL queries. I'm getting the error $Network error: Failed to fetch when I load my Gatsby page. I…
tbd_
  • 668
  • 5
  • 21
0
votes
1 answer

Adding multiple options in against single column in GraphQL

I am trying to make a query where I can add filters with multiple options. I currently have this query query FacilitiesQuery( $limit: Int $offset: Int $query: String $sort: [facilities_order_by!] ) { facilities( limit:…
Usman Tahir
  • 2,155
  • 3
  • 20
  • 33
0
votes
3 answers

After GraphQL Query: Property 'then' does not exist on type 'void'

I was using graphql mutations like this and the .then & .catch work perfectly: let submitForm = ( email: string, firstName: string ) => { setIsSubmitted(true); if (email && (firstName)) { const input: UpdateUserInput =…
Jnl
  • 953
  • 3
  • 25
0
votes
1 answer

How can I use Apollo's cacheRedirect with a nested query

I've got a query that looks like this: export const GET_PROJECT = gql` query GetProject($id: String!) { homework { getProject(id: $id) { ...ProjectFields } } } ${ProjectFieldsFragment} `; My InMemoryCache looks…
mithunm93
  • 381
  • 4
  • 16
0
votes
1 answer

How do I make Apollo Client tell me where in my code the error happened?

I'm learning React/Apollo and when I introduce bugs I get the typical red exceptions in my Chrome console. However, with Apollo, it doesn't tell me where in my code the error began as it does in React or other frameworks. When working with hooks…
Scott
  • 2,804
  • 3
  • 29
  • 35
0
votes
1 answer

How to format a graphQL query to be called from graphiql client?

I'm new to GraphQL and playing around with a sample React-GraphQL-Apollo project. When I try the query: { getStudentDetails(id: 12763454) { node(id:$id) { ... on Class_Student { id name …
Divya T
  • 11
0
votes
1 answer

How can I search an array with React apollo-client cache?

I have a simple search component and handleSearch function: const { data, loading, error } = useQuery(QUERY_GET_ELEMENTS); const client = useApolloClient();
ronan9018
  • 3
  • 2
0
votes
1 answer

Reset Apollo store and authenticated queries on logout

I'm trying to clear my Apollo store when users log out of my app, but having no luck getting everything to update correctly. Currently I am conditionally displaying authenticated/unauthenticated routes based on a current user being present. The…
mindlis
  • 1,296
  • 7
  • 14
0
votes
1 answer

Is there a way to check if Apollo has data cached before trying to call the cache?

I need to find out if Apollo has data cached before trying to call a query for that data from the cache. This code throws the "Invariant Violation: Can't find field ...... on object" error if we haven't already called the USER_QUERY. However I don't…
0
votes
2 answers

Running React Apollo website on Android device - the step with react-native is unclear

I'm using that React Apollo boilerplate. Now I want to deploy that Website to my Android device. So I did it exactly like the Running On Device tutorial said: Enable Debugging over USB all fine Plug in your device via USB adb devices my list…
kwoxer
  • 3,167
  • 3
  • 35
  • 51
0
votes
1 answer

useQuery hook didn't update on response

I'm try to return user to previous step after some updates on backend via useQuery apollo hook export const useOrderUnlock = () => { const [isLoading, setIsLoading] = useState(false); const isBlocked =…
0
votes
1 answer

Error: Query(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null

My React app return this error : Error: Query(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null. I've checked every line of my code but i can't figure what's going…
Théo Vogel
  • 95
  • 1
  • 9
1 2 3
99
100