question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[2.0] ApolloClient.reducer() method is gone, how to connect to redux?

See original GitHub issue

Intended outcome: Create a new Apollo client, then plug it into redux as a reducer per these instructions.

Actual outcome: Error: apolloClient.reducer is not a function.

How to reproduce the issue: I tried to do this using both code-sandbox and react-apollo-error-template but neither has been updated for 2.0 and neither would work with the beta code. Here’s what I’m trying to do:

import ApolloClient from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { combineReducers, createStore } from 'redux';

const httpLink = new HttpLink({ uri: 'https://some.data.url/' });
const apolloClient = new ApolloClient({ link: httpLink });

const store = createStore(
    combineReducers(
      {
        apollo: apolloClient.reducer(),
        someOtherReducer,
        ...
      }
    ));

Version

  • apollo-client@2.0.0-beta.4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:44 (14 by maintainers)

github_iconTop GitHub Comments

94reactions
jbaxleyiiicommented, Oct 10, 2017

@lrettig you don’t need to anymore! Any reason you want to?

66reactions
playerxcommented, Oct 19, 2017

cache implementation abstraction is good, but not having redux implementation out of the box is bad, because right now I’m using redux for time travel, epics and I don’t want to just drop it and replace with graphql client, because building chains with epics is really cool stuff. So I will not be able to move on 2.0 until there will be redux package for Apollo client 2.0. so will be other developers who use redux.

P.S. Great features in 2.0 but redux support (via middleware) is must have I think

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reducing our Redux code with React Apollo
I'm a firm believer that the best code is no code. More code often leads to more bugs and more time spent maintaining...
Read more >
ApolloClient reducer is not a function - Stack Overflow
I am using apolloClient to send requests to a graphql Server. However since my application use Redux I followed this document apollo-redux to...
Read more >
Integrating Apollo GraphQL Client into a Redux application for ...
The withApollo() enhancer provides direct access to the Apollo Client instance, meaning you can perform custom queries from within the component ...
Read more >
Integrating Microsoft Login and MSAL with React and Redux
The purpose of the reducer is to create a new version of the ... I can use the store.dispatch() method to dispatch each...
Read more >
Manage React state without redux - ITNEXT
How to use React Context API in an easier and prettier way. ... connect: The connect() function connects a React component to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found