@dne/apollo-client
v2.1.0
Published
An apollo-client preset package
Downloads
2
Readme
@dne Apollo-Client Package
Setup apollo provider with the client
import { createApolloClient, ApolloProvider } from '@dne/apollo-client';
const apolloClient = createApolloClient(API_URL, options);
function Application() {
return (
<ApolloProvider client={apolloClient}>
<App />
</ApolloProvider>
);
}
use hooks from installed @apollo packages
import { gql } from '@dne/apollo-client';
import { useQuery } from '@apollo/react-hooks';
const FETCH_ME = gql`
query fetchMe {
me {
id
}
}
`;
function App() {
const { loading, error, data } = useQuery(FETCH_ME);
return <div>{data.me.id}</div>;
}