title: React Create custom component to warn user before navigating while filling forms
body: <p>I am a react beginner. I would like to warn users when they are trying to navigate to a different page (By clicking on the sidebar or when they press the back arrow or forward arrow in the browser). I am aware of the prompt and I want to create a custom component to maintain the looks and feel of the website.</p>
  <p>I came across - <a href="https://medium.com/nerd-for-tech/custom-react-router-prompt-d325538b4d2b" rel="nofollow noreferrer">https://medium.com/nerd-for-tech/custom-react-router-prompt-d325538b4d2b</a> though most of these works there are a few limitations like if I press cancel a few times it does go back to the previous page.</p>