I have a React/React-Router application that is required to know the context on how users landed on the page. There could be two different cases (1) 302 redirection (2) client-side redirection.
Let me add use cases to give more details around it
(1): users directly hits the URL and landed on a page
(2): Users clicked a button and are redirected to another page via Link
API.
I noticed that the react router props contains history object and on (1) case, the history action is POP
while on client-side redirection cases (2) it was either PUSH
or REPLACE
. Would it be a good assumption that I can honor the history action and determine 302 redirection by checking the action === POP
?