Get previous paths from ReactRouter.browserHistory

Is it possible to get the previous number of paths and path values ​​from ReactRouter.browserHistory?

+4
source share
1 answer

Actually you cannot. But you can try to keep the list in a state browserHistoryand click the new path in it when redirecting.

let history = this.props.location.state.history;
history.push(this.props.location.pathname)
browserHistory.push({
            pathname: '/yourpath',
            state: { history: history }
        })
Run code

so you have to find your whole story in this.props.location.state.history

+1
source

Source: https://habr.com/ru/post/1661653/


All Articles