Problems trying to implement a Link tag to go back, but it works with browser's back button?

I have 3 nested components. The data displayed in the 2nd one is depending on your choice in the 1st one, and the data displayed in the 3rd one is a result of a choice in the 2nd one.

I'm using react-router and also redux. When I put a <Link> inside of the 2nd component to go back to the 1st one, it's all good, but the problem that I'm facing is when I implement a link tag in 3rd component to do the same (go back to the 2nd), it throws the error you see in the pic.

Additionally, when I try to do the same by using the browser back button, I don't have issues. I'm confused. I read a lot about it, experimented with withRouter, etc. Error remains.

error that is popping up

1 answer

  • answered 2018-04-14 16:51 Bigga_HD

    I used this as a solution. For future reference here's what I did:

    static contextTypes = {
                    router: () => {}