import gql from "graphql-tag"; import Link from "./Link"; const GET_VISIBILITY_FILTER = gql` { visibilityFilter @client } `; function FilterLink({ filter, children }) { const { data, client } = useQuery(GET_VISIBILITY_FILTER); return ( <Link onClick={() => client.writeData({ data: { visibilityFilter: filter } }) active={data.visibilityFilter === filter} > {children} </Link> ) }