Skip to content

Instantly share code, notes, and snippets.

@floydnoel
Created May 25, 2020 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floydnoel/458c45773441c1cb50f091ef4ace8022 to your computer and use it in GitHub Desktop.
Save floydnoel/458c45773441c1cb50f091ef4ace8022 to your computer and use it in GitHub Desktop.
const getSearchParams = () =>
window.location.search
.substring(1)
.split('&')
.reduce((acc, searchParam) => {
const [name, value] = searchParam.split('=');
return { ...acc, [name]: value };
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment