JSFiddle - React, Tailwind, and code Playground
JavaScript
const url = new URL(
'http://example.com/path/index.html?message=hello&who=world'
);
console.log(url.searchParams.get('message')); // => 'hello'
console.log(url.searchParams.get('missing')); // => null