Skip to content

Instantly share code, notes, and snippets.

@peggyrayzis
Last active December 21, 2017 20:53
Show Gist options
  • Save peggyrayzis/80ef21d3d7c9f0fa41918de737bc68d5 to your computer and use it in GitHub Desktop.
Save peggyrayzis/80ef21d3d7c9f0fa41918de737bc68d5 to your computer and use it in GitHub Desktop.
Example of a client query in apollo-link-state
const GET_USERS_ACTIVE_TODOS = gql`
{
visibilityFilter @client
user(id: 1) {
name
address
}
}
`;
const withActiveState = graphql(GET_USERS_ACTIVE_TODOS, {
props: ({ ownProps, data }) => ({
active: ownProps.filter === data.visibilityFilter,
data,
}),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment