Skip to content

Latest commit

 

History

History

react-hook

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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