react-use-pwa-install
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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.

Package Sidebar

Install

npm i react-use-pwa-install

Weekly Downloads

1,523

Version

1.0.3

License

ISC

Unpacked Size

7.37 kB

Total Files

8

Last publish

Collaborators

  • onset