title: How can I use redux and graphql with apollo client in the same react app?
body: <p>I'm working on a project, and I'm using apollo/client, graphql in react, and for the global state management, I have to use redux. I'm quite sure I'll have to handle more data in my project so I'll put it in my store.
  I'm wondering about how can I make redux actions to get data from graphql endpoint using apollo Client</p>
  <p>the first part is my index.js where I set up the apollo client.</p>
  <pre><code>
      import React from &quot;react&quot;;
      import ReactDOM from &quot;react-dom&quot;;
      import App from './App.jsx';
      import {BrowserRouter} from &quot;react-router-dom&quot;;
      import store from &quot;./store&quot;;
      import { Provider } from &quot;react-redux&quot;;
      import ApolloClient from 'apollo-boost';
      import { ApolloProvider } from 'react-apollo';
      import {InMemoryCache} from &quot;@apollo/client&quot;;
      
       const client = new ApolloClient({
          uri: 'http://localhost:4000/graphql',
          cache: new InMemoryCache()
        });
      
      ReactDOM.render(
          &lt;React.StrictMode&gt;
           &lt;ApolloProvider client={client}&gt;
          &lt;Provider store={store}&gt;
          &lt;BrowserRouter&gt;
              &lt;App /&gt;
              &lt;/BrowserRouter&gt;
              &lt;/Provider&gt;
              &lt;/ApolloProvider&gt;
          &lt;/React.StrictMode&gt;,
          document.getElementById(&quot;root&quot;)
      );
  
  </code></pre>
  <p>I have a problem with completing the action file of redux.
  it didn't send data to the rest of the app.</p>
  <pre><code>
      import {
       FETCH_PRODUCTS,
       FETCH_PRODUCTS_FAIL,
       FETCH_PRODUCTS_SUCCESS } from &quot;../types&quot;;
      import {gql} from &quot;apollo-boost&quot;;
      
      const getProductsQuery = gql`
      {
          category{
             products{
                 name
                 inStock
                gallery
                category
                prices{
                    currency
                    amount
                }
         }
      }
      
      }
      `
      
      const fetchProducts = () =&gt; async(dispatch) =&gt;{
          dispatch({
               type: FETCH_PRODUCTS,
           });
      
           try{
      
             //how can I get data from GRAPHQL by using apollo client
      
               dispatch({
                   type:FETCH_PRODUCTS_SUCCESS,
                   payload:data,
               });
              
           }
           catch(error){
               dispatch({
                   type: FETCH_PRODUCTS_FAIL,
                   payload:error.message
               });
           }
      
      }
      // export default graphql(getProductsQuery);
      export {fetchProducts};
  
  </code></pre>