This example uses the useNavigating hook to render a button when there is an active asynchronous navigation. Clicking the button will cancel the navigation.

Live Demo

Use the three buttons at the top of the Sandbox to toggle view modes. Clicking the menu button in the top left corner opens a menu to switch between files.

On GitHub

If you want to run this code locally, the source code is available on GitHub.