querystring.stringify({
error: 'error_status'
})
'querystring' is deprecated, how would I replace it with the native URLSearchParams here?
CodePudding user response:
const params = new URLSearchParams({
error: 'error_status'
});
console.log(params.toString());
// error=error_status
console.log(`?${params.toString()}`);
// ?error=error_status
More information at https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams