Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

react-pwa-install-prompt

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

react-pwa-install-prompt

A react hook to prompt the install of your PWA in supported browers (Chrome desktop & mobile)

    1.0.5latest

Version published
Maintainers
1
Yearly downloads
6,803
increased by317.36%

Weekly downloads

Readme

Source

react-pwa-install-prompt

A react hook to prompt the install of your PWA in supported browsers (Chrome desktop & mobile)

NPM JavaScript Style Guide

Install

yarn add react-pwa-install-prompt

Usage

import React from 'react' import usePWA from 'react-pwa-install-prompt' const Example = () => { const { isStandalone, isInstallPromptSupported, promptInstall } = usePWA() const onClickInstall = async () => { const didInstall = await promptInstall() if (didInstall) { // User accepted PWA install } } const renderInstallButton = () => { if (isInstallPromptSupported && isStandalone) return ( <button onClick={onClickInstall}>Prompt PWA Install</button> ) return null } return (<div> <h2>PWA Infos</h2> <p>Is Install Prompt Supported ? {isInstallPromptSupported ? 'true' : 'false'}</p> <p>Is Standalone ? {isStandalone ? 'true' : 'false'}</p> {renderInstallButton()} </div>) } export default Example

License

MIT © eric-edouard

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc