How to use the react-relay-offline/lib/hooks/useOffline function in react-relay-offline

To help you get started, we’ve selected a few react-relay-offline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morrys / offline-examples / relay / todo-updater / js / components / TodoOffline.js View on Github external
const TodoOffline = ({relay, user, retry}) => {
  const offlineState = useOffline();

  const requests = [];

  Object.values(offlineState).forEach(offlineRecord => {
    requests.push(offlineRecord);
    /*
            const { request } = payload;
            const snapshot = RelayReader.read(request.sinkPublish, request.operation.fragment);
            this work only with optimisticResponse
        */
  });

  const execute = () => {
    relay.environment.getStoreOffline().execute();
  };