There is now no way to know if the user navigated forward or backward (or using "replace") to the current page. The thing is, by hiding the history - which I totallly understand as a design decision as it's kind of the inner plumbing but not necessarily something you want publicly exposed as a formal API - you've also removed crucial things like the navigation action. when pathname stays the same, but history changes).Īlternatively, you could consider exposing just the history change event via a hook, e.g. Using solution with useEffect and location.pathname isn't ideal, because the overlay should close even when clicking on the current page link (i.e. My use case is a navigation overlay which needs to close each time user clicks a link.
0 Comments
Leave a Reply. |