this is probably the second code-related question I will be asking on this platform. I am working with React Js.
I imported useLocation hook from 'react-router-dom" and defined location as follows
location = useLocation()
How can I detect the current page and the next page I navigated to when I make a click action?
<location.pathname> detects the current page pathname. For example, Assuming I am on page 1 and I navigate to page 2 when I make a click action, While on page 2, how can I detect that I navigated from page 1 to page 2?