Skip to main content
Version: 4.3

PollingSubscription implements Subscription

Will dispatch a fetch action at the minimum interval of all subscriptions to this resource.

  • Pauses when offline.
  • Immediately fetches when online status returns.
  • Immediately fetches any new subscriptions.
import {
SubscriptionManager,
PollingSubscription,
CacheProvider,
} from 'rest-hooks';
import ReactDOM from 'react-dom';

const subscriptionManager = new SubscriptionManager(PollingSubscription);

ReactDOM.render(
<CacheProvider subscriptionManager={subscriptionManager}>
<App />
</CacheProvider>,
document.body,
);

Dispatched Actions

  • 'rest-hooks/fetch'

Note:

This is already used by CacheProvider by default.