react-offline-cache
v0.0.6
Published
A basic cache for React applications. Offline cache to applications. It also serves as a reference for more advanced caching implementations.
Downloads
9
Maintainers
Readme
react-offline-cache
Create a cache to offline connection
A basic cache for React applications. Offline cache to applications. It also serves as a reference for more advanced caching implementations.
Install
npm install react-offline-cache
src/index.js
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
// react-offline-cache
import * as roc from 'react-offline-cache';
ReactDOM.render(<App />, document.getElementById("root"));
// init faster
roc.register();
How to remove
roc.unregister();
Is online
console.log('online:', roc.isOnline());
Is offline
if(roc.isOffline()) {
window.alert('Your internet is offline. Sorry.');
}
License
The MIT License.