This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { gql } from 'apollo-boost'; | |
import { withApollo } from 'react-apollo'; | |
class Query extends Component { | |
state = { | |
data: null, | |
loading: true | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { gql } from 'apollo-boost'; | |
const FakeQuery = (props) => { | |
const { query } = props; | |
const data = { | |
loading: false, | |
error: null, | |
data: null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { gql } from 'apollo-boost'; | |
const FakeQuery = (props) => { | |
return props.children('Hello World'); | |
} | |
const MyComponent = (props) => { | |
return ( | |
<FakeQuery> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FakeQuery = (props) => { | |
return props.children(); | |
} | |
const MyComponent = (props) => { | |
return ( | |
<FakeQuery> | |
{ () => { return null } } | |
</FakeQuery> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Query } from "react-apollo"; | |
import { gql } from "apollo-boost"; | |
const MyComponent = props => | |
<Query | |
query={MY_QUERY}> | |
{({ data, loading, error }) => { | |
if (loading) return 'Loading'; | |
if (error) return `Error!: ${error}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { gql } from 'apollo-boost' | |
import { graphql } from 'react-apollo' | |
const MyComponent = ({data}) => { | |
const { loading, error, things} = data; | |
if (loading) return 'Loading' | |
if (error) return `Error: ${error}` | |
return ( | |
<div> |