JSFiddle - React, Tailwind, and code Playground
JavaScript
const parseQuery = () => {
const search = window.location.search;
let query = {};
search
.slice(1)
.split("&")
.forEach((it) => {
const [key, value] = it.split("=");
query[key] = decodeURIComponent(value);
});
console.log(query)
return query;
};
parseQuery();