I am currently working on a project for mobile webview which developed by React, so I need a ‘<’ button at the top for backward navigation. Because my project use umijs as routing framework, I can just simply use router.push(path) , router.replace(path) and router.goback()to deal with forward & backward navigation.

How to use it:

  • router.push() push the URL to history stack which you wish you can go back by clicking the ‘<’ button
  • router.replace() replace current page’s URL to a new URL, no history in the history stack
  • router.goback() set it to ‘<’ button’s onClick function. when you click on this button, the history stack will pop the latest URL and redirect to that page

The native React Router has the same functionalities as umi, they are createBrowserHistory, createMemoryHistory and createHashHistory

For more detail please visit React Router and umi Router



Any feedback is welcome! :-)