-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHelloWorld.js
47 lines (43 loc) · 915 Bytes
/
HelloWorld.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React, { Component } from 'react';
import { Query } from 'react-apollo';
import gql from 'graphql-tag';
const queryText = gql`
query {
collection(id: "https://view.nls.uk/collections/7446/74466699.json") {
id
type
label
metadata {
label
value
}
}
manifest(id: "https://wellcomelibrary.org/iiif/b20432033/manifest") {
id
type
label
metadata {
label
value
}
}
}
`;
class HelloWorld extends Component {
render() {
return (
<Query query={queryText}>
{({ data, loading, error }) => {
if (loading) {
return <h2> Loading </h2>;
}
if (error) {
return <h2> {JSON.stringify(error)} </h2>;
}
return <pre>{JSON.stringify(data, null, 2)}</pre>;
}}
</Query>
);
}
}
export default HelloWorld;