Skip to content

Commit b882d53

Browse files
committed
Add GraphQLDemo
1 parent 7439403 commit b882d53

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import logo from './logo.svg';
33
import './App.css';
44

55
import LambdaDemo from './LambdaDemo';
6+
import GraphQLDemo from './GraphQLDemo';
67

78
const App = () => {
89
return (
@@ -13,6 +14,7 @@ const App = () => {
1314
Edit <code>src/App.js</code> and save to reload.
1415
</p>
1516
<LambdaDemo />
17+
<GraphQLDemo />
1618
</header>
1719
</div>
1820
);

src/GraphQLDemo/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import { useQuery } from '@apollo/react-hooks';
3+
import { gql } from 'apollo-boost';
4+
5+
const GraphQLDemo = () => {
6+
const { data } = useQuery(gql`
7+
query {
8+
hello
9+
}
10+
`);
11+
return (
12+
<div>
13+
A greeting from the GraphQL server: {data ? data.hello : ''}
14+
</div>
15+
);
16+
};
17+
18+
export default GraphQLDemo;

0 commit comments

Comments
 (0)