Skip to content
Discussion options

You must be logged in to vote

In v6, you can inspect the location object returned by the useLocation hook for this use case. When the history stack is empty, the location.key will have the value "default".

const doesAnyHistoryEntryExist = location.key !== "default";

Ref: history library docs

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@cliffordfajardo
Comment options

Answer selected by cliffordfajardo
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants