@next-with-offline/react-hook

4.0.3 • Public • Published

@next-with-offline/react-hook

size dependencies build downloads license

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>;
}

Package Sidebar

Install

npm i @next-with-offline/react-hook

Weekly Downloads

30

Version

4.0.3

License

MIT

Unpacked Size

10.7 kB

Total Files

6

Last publish

Collaborators

  • cansin