Skip to content

Initial Launch URL #130

Answered by ShafSpecs
GoodluckH asked this question in Q&A
Oct 18, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Typically, you would want to use the appinstalled event available on the Window interface. In your root, or layout route, you can do something like this:

useEffect(() ={
 if (typeof window === 'undefined') return;

 window.addEventListener('appinstalled', () => {
  navigate('/')
 })

 return () => /* remove the event listener here */
}, [])

Something like this should get the job done 👍. Lemme know if it worked for you or you found a better approach. Have a look at: https://developer.mozilla.org/en-US/docs/Web/API/Window/appinstalled_event whilst at it.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GoodluckH
Comment options

Answer selected by GoodluckH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants