useNavigationType

Returns the current navigation action which describes how the router came to the current location, either by a pop, push, or replace on the history stack.

See also

https

://reactrouter.com/hooks/use-navigation-type