Skip to content

Instantly share code, notes, and snippets.

@AndreiCalazans
Created August 25, 2017 11:12
Show Gist options
  • Save AndreiCalazans/e6cb443081ef898db7e6891f109ec3e9 to your computer and use it in GitHub Desktop.
Save AndreiCalazans/e6cb443081ef898db7e6891f109ec3e9 to your computer and use it in GitHub Desktop.
Query Renderer
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