Busenur Adıbelli
Busenur Adıbelli

Reputation: 67

How can I create a client via redux toolkit and using apollo and use graphql?

I'm new in this field. I'm very confused and need help.

How can I perform all GraphQL queries and mutations via Redux Toolkit?

(I should use the mutation only to get the token information while the user is logging in.)

While doing these, I need to use client.mutate / client.query instead of useQuery and useMutation, but I couldn't find any examples anywhere.

Upvotes: 1

Views: 510

Answers (1)

phry
phry

Reputation: 44078

If you already use Apollo, you should not be using Redux Toolkit for api requests on to of that. Apollo is already a full-fledged api client & cache. You don't need to add a hand-written cache layer on top of that.

In this case you can still use Redux to manage non-api application state, but don't use it to do Apollo's job.

Upvotes: 1

Related Questions