'How to replace querystring.stringify with URLSearchParams?
querystring.stringify({
error: 'error_status'
})
'querystring' is deprecated, how would I replace it with the native URLSearchParams here?
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ross |
