'React navigation via props.history.back

In my React app, I have different routes. Now, if I bookmark one of the URLs (which has a Back btn) and if user goes back (either browser or via the Back btn), the following code is executed and user is taken to a blank page

props.history.goBack()

Now my questions are;

  1. If there is any way to handle the same i.e. in case the Back route is empty, then navigate to a different preset route ?
  2. Is it possible to disable the Back btn in this case i.e. if user visits the route via bookmark, then disable the Back btn (since there is no Back in this case)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source