How do GraphQL & Redux work together?

Posted by Editorial Staff | Updated on

In this answer, We have shared how do GraphQL & Redux work together? You have to distinguish between view state (e.g. search field, popup, toggle) and data state (e.g. remote API). Whereas Apollo is mainly used for data state, Redux/MobX/React’s Local State are used for view state when used in combination with Apollo Client. If not used with Apollo Client, these solutions can be used for the remote data state too.

If your application is purely remote data driven and uses a GraphQL backend, Apollo Client can be sufficient for your application.

If you have a few view states in your application, mix in React’s local state management.

If you have several to a lot of view states, use Redux or MobX for your view state or try out apollo-link-state.

Maybe this article clarifies some things more in-depth: Combining Redux and Apollo.

Opinion: I feel like in the time of React Hooks, Redux and MobX are getting less relevant. Over here, you can find an in-depth article about all the state management options in React.

Reference:
https://stackoverflow.com/questions/48500747/how-do-graphql-redux-work-together


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers