setRouteWillLeaveHook provides a method for us to intercept a route change before leaving the current route.
Why do we set the 'setRouteWillLeaveHook' in the componentWillMount lifecycle?
Great question! My personal preference is to make these types of component alterations before the component has mounted if possible. However, you could just as easily do it in componentDidMount.
I wanted to clarify that it is setRouteLeaveHook not setRouteWillLeaveHook. Am I right?
Yes. Good catch.
What about routes with limited acces (role based)?