I make react app from Create React App then use default config PWA. But i got confused how to hide button add to screen. Any one can help me? thank you
Advertisement
Answer
You need to prevent the installation:
window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault() })
In addition you can save the installation event and create a custom install button:
let installEvent; window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault() installEvent = e; }) button.onclick = () => { installEvent.prompt() }