Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 954 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 954 Bytes

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);