DEV Community

Discussion on: I built a chat app using React and GraphQL

Collapse
 
rafarochas91 profile image
Rafael Rocha

What's your thought of using Apollo Client as a state manager for this use case?
Since the entities would be cached this could probably improve overall performance of querying new changes and reduce complexity by not having to maintain a redux store.
Nice article!

Collapse
 
aouahib profile image
Abdou Ouahib

I am using Apollo Client to make GraphQL operations, I just don't use its hooks for state management, so everything is still being cached.

I never tried to use ApolloClient as a state manager, but if I wanted to, I would use it in some pages of the app that don't have a complex state, for example, the search page, where you just send a query and display the results.

For more complex stuff like messaging, I don't see how Apollo Client alone can do the job, you'll definitely need something more powerful.

Collapse
 
rafarochas91 profile image
Rafael Rocha

I find that apollo client with a normalized cache object to be more than enough for this cases global app state. But I also can see the point of approaching a more familiar tool like redux. It's not a bad approach by any means.
I've used apollo client in realtime production ready client applications and it has fit a lot of different use cases, some of them more complex than p2p chats, like small interactive cooperative data visualization apps.

Thread Thread
 
aouahib profile image
Abdou Ouahib

That's actually interesting, I'll definitely do more research on this subject. Thanks for the insights.