react-service-worker
Version:
Simple and powerful alternative for the default create-react-app registerServiceWorker
28 lines (14 loc) • 861 B
Markdown
and powerful alternative for the default create-react-app registerServiceWorker
npm install react-service-worker -S
the default `registerServiceWorker` generated by `create-react-app` is very simple and only gives you ways to register and unregister your service worker. Any other action should be implemented manually.
The `react-service-worker` module provides better organization and more features like listen for updates on your APP easily.
The integration is very simple, just open the `src/index` file in your project and replace
import registerServiceWorker from './registerServiceWorker';
for:
import registerServiceWorker from 'react-service-worker';
and done! This way, the react service worker will act just like the default registerServiceWorker.
`npm test`
Simple