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

0.0.2 • Public • Published

react-use-a2hs

version size minzippedsize

Access Before Install Prompt Event using React hooks.

Support Only Chrome and Edge.

How to use it

import React from "react";
import ReactDOM from "react-dom";
import { useA2HS } from "react-use-a2hs";

function App() {
  const [promptEvent, promptToInstall] = useA2HS();

  return (
    <div className="App">
      {promptEvent && (
        <button onClick={promptToInstall}>{"please install PWA"}</button>
      )}
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Package Sidebar

Install

npm i react-use-a2hs

Weekly Downloads

25

Version

0.0.2

License

MIT

Unpacked Size

7.84 kB

Total Files

11

Last publish

Collaborators

  • kodai