Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 11, 2018 13:24
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 productioncoder/f773e41142650ba6b310f7b6edf3fd83 to your computer and use it in GitHub Desktop.
Save productioncoder/f773e41142650ba6b310f7b6edf3fd83 to your computer and use it in GitHub Desktop.
Youtube in React: get search param
export const getSearchParam = (location, name) => {
if (!location || !location.search) {
return null;
}
const searchParams = new URLSearchParams(location.search);
return searchParams.get(name);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment