What is the correct way to extract a query string in ES6?
I have written this function:
getUrlParams(queryString) {
const hashes = queryString.slice(queryString.indexOf('?') + 1).split('&');
const params = {};
hashes.map((hash) => {
const [key, val] = hash.split('=');
params[key] = decodeURIComponent(val);
});
return params;
}
However ESLint compains that it expected this to be used by class method and it expected a return value in the arrow function.