@next-with-offline/react-hook
v4.0.3
Published
React hook for registering/using a Workbox.
Downloads
6
Maintainers
Readme
@next-with-offline/react-hook
React hook for registering/using a Workbox. Intended to be used alongside @next-with-offline/next-plugin and @next-with-offline/service-worker. Read the top level documentation for more information about usage.
Install
yarn add @next-with-offline/react-hook workbox-window
Basic Usage
import React from "react";
import { useOffline } from "@next-with-offline/react-hook";
export default function Component() {
useOffline({
offlinePath: "/offline",
registerOptions: {},
scriptURL: "sw.js",
showReloadPrompt: false,
});
return <p>Hello World!</p>;
}