Created
August 25, 2017 11:12
-
-
Save AndreiCalazans/e6cb443081ef898db7e6891f109ec3e9 to your computer and use it in GitHub Desktop.
Query Renderer
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 LinkListPageQuery = graphql` | |
query LinkListPageQuery( | |
$count: Int!, | |
$filter: LinkFilter, | |
$after: String, | |
) { | |
viewer { | |
...LinkList_viewer | |
} | |
} | |
`; | |
class LinkListPage extends React.Component { | |
render() { | |
return ( | |
<QueryRenderer | |
environment={environment} | |
variables={{ | |
count: ITEMS_PER_PAGE, | |
filter: { | |
description_contains: '', | |
} | |
}} | |
query={LinkListPageQuery} | |
render={({error, props}) => { | |
if (error) { | |
return <div>{error.message}</ div> | |
} else if (props) { | |
return <LinkList viewer={props.viewer} /> | |
} | |
return <div>Loading</ div> | |
}} | |
/> | |
) | |
} | |
} | |
export default LinkListPage; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment