document.write("
import gql from 'graphql-tag';
import { Query } from 'react-apollo';
const query = gql`
query SomeQuery {
foo {
bar
baz
}
}
`;
function MyComponent() {
return (
<Query query={query}>
{(result) => {
if (result.loading) return <Loading />;
if (result.error) return <Error error={error} />;
const { data } = result;
return <h1>Hello {data.foo.bar} {data.foo.baz}!</h1>;
})
</Query>
);
}
querycomponent.js - Snippet hosted by \"Cacher\"
");