JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1389
  • Score
    100M100P100Q108839F
  • License ISC

Custom React hook for PWA install button.

Package Exports

  • react-use-pwa-install
  • react-use-pwa-install/dist/index.es.js
  • react-use-pwa-install/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-use-pwa-install) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-use-pwa-install npm npm type definitions

Custom React hook for PWA install button.

Installation

npm install react-use-pwa-install

How to use

import { usePWAInstall } from 'react-use-pwa-install'

export const Header = () => {
    const install = usePWAInstall()

    return (
        <header>
            <h1>My app</h1>
            {install && <button onClick={install}>Install</button>}
        </header>
    )
}

Screencast

UI example

Demo

Check website or code.

Note

Don't forget to fulfill PWA requirements (web.dev, mdn) otherwise the usePWAInstall will return null. Same goes for already installed app.