Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from "react";
- import { render } from "react-dom";
- import { ApolloClient, HttpLink, InMemoryCache } from "apollo-boost";
- import { ApolloProvider, graphql } from "react-apollo";
- import gql from "graphql-tag";
- const client = new ApolloClient({
- link: new HttpLink({
- uri: "http://localhost:3000/graphql"
- }),
- cache: new InMemoryCache()
- });
- class App extends Component {
- render() {
- console.log("r");
- client
- .query({
- query: gql`
- {
- hello
- }
- `
- })
- .then(console.log);
- return (
- <ApolloProvider client={client}>
- <div>
- <h1>Application is ready now</h1>
- </div>
- </ApolloProvider>
- );
- }
- }
- render(<App />, document.getElementById("root"));
Advertisement
Add Comment
Please, Sign In to add comment