Guest User

Untitled

a guest
Mar 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import React, { Component } from "react";
  2. import { render } from "react-dom";
  3. import { ApolloClient, HttpLink, InMemoryCache } from "apollo-boost";
  4. import { ApolloProvider, graphql } from "react-apollo";
  5. import gql from "graphql-tag";
  6.  
  7. const client = new ApolloClient({
  8. link: new HttpLink({
  9. uri: "http://localhost:3000/graphql"
  10. }),
  11. cache: new InMemoryCache()
  12. });
  13.  
  14. class App extends Component {
  15. render() {
  16. console.log("r");
  17. client
  18. .query({
  19. query: gql`
  20. {
  21. hello
  22. }
  23. `
  24. })
  25. .then(console.log);
  26. return (
  27. <ApolloProvider client={client}>
  28. <div>
  29. <h1>Application is ready now</h1>
  30. </div>
  31. </ApolloProvider>
  32. );
  33. }
  34. }
  35.  
  36. render(<App />, document.getElementById("root"));
Advertisement
Add Comment
Please, Sign In to add comment