Apollo-client: Where did createNetworkInterface go?

Created on 2 Nov 2017  路  7Comments  路  Source: apollographql/apollo-client

react-apollo docs mentions I import createNetworkInterface from react-apollo:

import { ApolloClient, createNetworkInterface } from 'react-apollo';
const networkInterface = createNetworkInterface({
  uri: 'http://api.example.com/graphql'
});
const client = new ApolloClient({
  networkInterface: networkInterface
});

However that wasn't working, as I'm getting Uncaught TypeError: (0 , _reactApollo.createNetworkInterface) is not a function. [After a bit of reading](https://github.com/apollographql/apollo-client/issues/108), it appears the docs is incorrect or out of date, and instead I should try importing it fromapollo-client`

Then apollo-client docs mention:

import ApolloClient, { createNetworkInterface } from 'apollo-client';
const networkInterface = createNetworkInterface({ uri: 'https://example.com/graphql' });
const client = new ApolloClient({
  networkInterface,
});

That also doesn't work, failing with the same 'not a function' error as before. Grepping through the apollo-code i have in node_modules, I can't find any mention of createNetworkInterface.

I have [email protected] and `[email protected] installed.

Where am I supposed to get it from? What am I doing wrong?

Most helpful comment

createNetworkInterface was removed in 2.x. Refer to the upgrade docs and new documentation
https://github.com/apollographql/apollo-client/blob/master/Upgrade.md

docs: https://www.apollographql.com/docs/react/ (linked on project README)

All 7 comments

createNetworkInterface was removed in 2.x. Refer to the upgrade docs and new documentation
https://github.com/apollographql/apollo-client/blob/master/Upgrade.md

docs: https://www.apollographql.com/docs/react/ (linked on project README)

Ahhh right hmm okay. I was reading the docs at dev.apollodata.com, which is confusing to say the least.

Thanks for the help.

@joshhunt do you know how you got your local host working on https?

createNetworkInterface was removed in 2.x. Refer to the upgrade docs and new documentation
https://github.com/apollographql/apollo-client/blob/master/Upgrade.md

docs: https://www.apollographql.com/docs/react/ (linked on project README)

well the first link no longer works and I am wondering what I have to do in order to upgrade....

That link is also broken now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joergbaier picture joergbaier  路  3Comments

stubailo picture stubailo  路  3Comments

rafgraph picture rafgraph  路  3Comments

NeoPhi picture NeoPhi  路  3Comments

treecy picture treecy  路  3Comments