I like to use the URL API in such cases
const url = new URL('http://myapi.com/orders'); url.searchParams.append('sort', 'date'); url.searchParams.append('order', 'desc'); fetch(url.href);
https://developer.mozilla.org/en-US/docs/Web/API/URL