Skip to content

kodai3/react-use-a2hs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Use Before Install Prompt Event with React Hooks

Resources

License

Stars

Watchers

Forks

Packages

No packages published