Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/filipchalupa/react-use-pwa-install


https://github.com/filipchalupa/react-use-pwa-install

hook pwa react

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# react-use-pwa-install [![npm](https://img.shields.io/npm/v/react-use-pwa-install.svg)](https://www.npmjs.com/package/react-use-pwa-install) ![npm type definitions](https://img.shields.io/npm/types/react-use-pwa-install.svg)

Custom React hook for PWA install button.

## Installation

```bash
npm install react-use-pwa-install
```

## How to use

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

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

return (

My app


{install && Install}

)
}
```

### Screencast

![UI example](https://raw.githubusercontent.com/FilipChalupa/pwa-install-handler/HEAD/screencast.gif)

### Demo

Check [website](https://react-use-pwa-install-demo.glitch.me/) or [code](https://glitch.com/edit/#!/react-use-pwa-install-demo).

## Note

Don't forget to fulfill PWA requirements ([web.dev](https://web.dev/install-criteria/), [mdn](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs)) otherwise the `usePWAInstall` will return `null`. Same goes for already installed app.