Created
December 7, 2021 10:41
-
-
Save junhoyeo/569058a7b42d3ba5763bd8b3fd7b85f0 to your computer and use it in GitHub Desktop.
Remove query parameter from current route
This file contains hidden or 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
export const removeQueryParameter = (name: string) => { | |
const params = new URLSearchParams(location.search) | |
params.delete(name) | |
history.replaceState(null, '', '?' + params + location.hash) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment