JSFiddle - React, Tailwind, and code Playground

HTML

<pre id="output"></pre>

JavaScript

function getUrlParams(search = window.location.search) {
    let hashes = search.slice(search.indexOf('?') + 1).split('&')
    let params = {}
    hashes.map(hash => {
        let [key, val] = hash.split('=')
        params[key] = decodeURIComponent(val)
    })

    return params
}

// testing
const url = 'https://www.google.com/search?q=hello+world&rlz=1C1GGGE_rufooBar&oq=hello+world&aqs=chrome..6944444444&sourceid=chrome&ie=UTF-8'
const parsedParams = getUrlParams(url)
console.log(parsedParams)
output.textContent = JSON.stringify(parsedParams, null, 4)