Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube in React: get search param
export const getSearchParam = (location, name) => {
if (!location || ! {
return null;
const searchParams = new URLSearchParams(;
return searchParams.get(name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment