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 from
apollo-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?
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.mddocs: 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....
Docs are now here
https://www.apollographql.com/docs/react/recipes/2.0-migration.html
That link is also broken now.
Use links instead,
https://www.apollographql.com/docs/link/links/http/#upgrade-apollo-client-10
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)