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

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
Demo
Note
Don't forget to fulfill PWA requirements (web.dev, mdn) otherwise the usePWAInstall
will return null
. Same goes for already installed app.