Created
December 24, 2023 12:24
-
-
Save barhoring/a0bf329e1f347663dfcad760ec8fb483 to your computer and use it in GitHub Desktop.
Proxy on push state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const originalPushState = window.history.pushState; | |
window.history.pushState = function () { | |
// Your custom logic here before calling the original pushState | |
// Call the original pushState method | |
// @ts-ignore | |
return originalPushState.apply(window.history, arguments); | |
}; | |
const Root = () => { | |
return ( | |
<StrictMode> | |
<App /> | |
</StrictMode> | |
); | |
}; | |
const container = document.getElementById('root'); | |
if (container) { | |
const root = createRoot(container); | |
root.render(<Root />); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment