Polling

The usePoll hook allows you re-fetch data at a set interval. Polling can be paused/resumed, and is stopped when the component unmounts.

Usage

Simply call usePoll with the data you want polled, and the interval in which it should be:

import { graphql, usePoll } from '@gqless/react'
const Component = graphql(() => {
usePoll(query.hello, 5000) // every 5s
return <div>{query.hello}</div>
})
Last updated on by Sam Denty