I am trying to access history stack of react-router.
Here is what I want to do:
I create a board using react.js and react-router.
If a user clicks one of the list on the board, it goes to the detail page.
Suppose the user clicks article that has id 3 on the list, react-router goes to detail page of id 3 article and the url form will be below.
localhost:3000/board/3
In the detail page, there is go to the list button and when user clicks it, page will be moved to the list page again and I will use history.back() here.
So far, it is easy to make it using react-router.
However there is another page that user can access detail page, let's say profile page.
If user access detail page through profile page, go to the list button should behave different. It pushes the user to user-list page.
To sum up, go to the list button works like this below:
board -> detail -> click go to the list -> board
profile -> detail -> click go to the list -> user-list
In order to push user to different page according to where the user was at, I need to see where the user has come from therefore I need to see history stack or is there other way I can check what url the user came from?
