2.1.0 • Published 4 years ago

@dne/apollo-client v2.1.0

Weekly downloads
6
License
MIT
Repository
-
Last release
4 years ago

@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>;
}