Replies: 1 comment 3 replies
-
Hi, that is a good question. This patch is needed in order to intercept |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've noticed that Wouter reassigns 'window.history.pushState' and 'window.history.replaceState'.
On first thought, it seems like this is quite sensitive to the order in which libraries load, one could for example store
const pushState = window.history.pushState
in some closure before Wouter patches it. Doing this withwindow.history.go
causes an illegal invocation error but it doesn't seem that way withpushState
.So is there anything to lose from creating a wrapper around
window.history
instead of patching it? Thenavigate
function is exported anyway, so I don't think it would change anything to have a wrapped history object in its closure. This is the way react-router does it, seecreateBrowserHistory()
.What do you think? Did I miss something that's only possible with the patching method? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions