# use-install-prompt

> > A hook for accessing Google Chrome's [Install](https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent) button for PWAs.

Latest version **1.0.0** (published 2020-06-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install use-install-prompt
pnpm add use-install-prompt
yarn add use-install-prompt
bun add use-install-prompt
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-06-12 |
| First published | 2020-06-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | nrgapple |
| Maintainers | nrgapple |
| Keywords | hooks, react, PWA |

## Links

- npm: https://www.npmjs.com/package/use-install-prompt
- Repository: https://github.com/nrgapple/useInstallPrompt
- Homepage: https://github.com/nrgapple/useInstallPrompt#readme
- Issues: https://github.com/nrgapple/useInstallPrompt/issues
- npm.io page: https://npm.io/package/use-install-prompt

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-06-12
- 0.0.2 — 2020-06-12
- 0.0.1 — 2020-06-12

## README

# useInstallPrompt ⚛️

> A hook for accessing Google Chrome's [Install](https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent) button for PWAs.

![](https://user-images.githubusercontent.com/10817537/84545881-17c13580-acce-11ea-900b-61fa192ec566.png)

![](https://user-images.githubusercontent.com/10817537/84545818-f19b9580-accd-11ea-9cfb-a309d72c6350.png)

## [Install](https://www.npmjs.com/package/use-install-prompt)

```bash
npm i use-install-prompt
```

## Usage

```tsx
import React from "react"
import useInstallPrompt from "use-install-prompt"

const App: React.FC = () => {
  const [prompt, promptToInstall] = useInstallPrompt()

  return prompt ? (
    <button onClick={promptToInstall} />
  ) : (
    <h1>Browser not supported.</h1>
  )
}
```

Call `promptToInstall` to show the install prompt in Chrome.

Check if `prompt` is defined to deside whether to show a button or not. (On a supported browser)

---
_Source: https://npm.io/package/use-install-prompt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
