For example, my browser history looks like this:
/page1 > /page2 > /page3 > /page4 > /page5
I want to navigate to /page2 from /page5, and then navigate to /page1 with history.goBack()
function. I tried go(-3)
, but it works just like push()
. I need something like goBack(-3)
or replace(-3)
, or maybe there is another way?
These are the ways to redirect to the pages.
props.histrory.push() // in push method you can pass routes specified in app
Can use component called Redirect ex: <Redirect to={''} />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.