react-apollo-hooks Questions

2

The issue: Hello, so I've been using apollo-client for a while on my ReactJS application. I've just noticed that sometimes when I use the useQuery hook, the execution completely ignores the skip a...

2

Solved

I am using apollo-graphql in my react project and i am getting error of Invalid hook call. Hooks can only be called inside of the body of a function component Here is my code for this import Reac...
Permeance asked 26/7, 2021 at 5:37

2

Solved

Because of the Rules of Hooks, one shouldn't call hooks conditionally. So how does one fetch data conditionally using useQuery? For example, let's say I want to fetch data inside a functional compo...
Svoboda asked 28/4, 2020 at 2:56

3

I have a custom debounce hook for apollo lazy queries: import {useLazyQuery} from '@apollo/react-hooks'; import debounce from "lodash/debounce"; export function useDebouncedQuery(schema) { const...
Anglicism asked 9/8, 2019 at 16:55

2

Solved

I am using useMutation hook in react project. The mutation runs successfully but it's not reaching onCompleted afterwards. I have set notifyOnNetworkStatusChange to true in the mutation but that ...
Caper asked 30/8, 2019 at 20:36

2

Solved

Using useLazyQuery() hooks from @apollo/react-hooks I was able to execute a query on click of a button. But I cannot use it execute same query on consecutive clicks. export default ({ queryVariabl...

2

I'm getting an unhandled promise rejection error when I use useMutation with react native. Here's the code producing the issue: const [createUser, { error, loading }] = useMutation(CREATE_USER_MUT...
Idioglossia asked 10/8, 2019 at 15:21

1

Solved

I'm trying to create a custom Apollo Client mutation hook in a TypeScript project in the following shape: const customApolloMutation = () => { const [ mutationFunction, { data, loading, erro...
Selfrighteous asked 7/4, 2021 at 17:51

2

Solved

I use the useQuery Hook like this: function Foo() { const { data, error, loading } = useQuery(MY_QUERY, { pollInterval: 1000 }); return ( <> <Bar/> <Baz/> {data} </&g...

1

Solved

I'm using the most excellent react-apollo-hooks library, specifically the useQuery hook: function Index() { ... const [dialogOpen, setDialogOpen] = useState({ show: false, id: '0' }); ... con...
Bigler asked 9/5, 2019 at 17:6

0

I just recently started to learn GraphQL and React-Apollo and I'm wondering what's the recommended approach of using useQuery and useMutation hooks if I need them inside the same component. S...
Consecrate asked 25/6, 2020 at 8:31

0

In my query, I use a blend of remote and local properties. The local properties have different values depending on: The remote properties The current unix timestamp The local resolvers computes...
Leukemia asked 2/11, 2019 at 18:26

1

Solved

I'm trying to implement a custom hook to provide the app with a guest shopping cart. My hook wraps around the useMutation hook from Apollo and it saves the shopping cart id in a cookie while also p...
Pipestone asked 19/9, 2019 at 9:3

1

I have a React component that uses the Apollo hooks lib's useQuery hook. I'm having trouble testing this component. Here is my current setup. import React from 'react'; import { BrowserRouter as ...

1

Solved

In my many attempts, I've tried to use react-apollo-hooks and formik together but it seems impossible. The data from the forms is only available in the <Formik> tag, and is otherwise inaccess...
Hirsch asked 19/7, 2019 at 9:38
1

© 2022 - 2024 — McMap. All rights reserved.