Passing params in URL from React-Native

I want to pass search parameters to a request URL while calling it from React-Native framework using the code as below

const obj = {
  param1: 'val1',
  param2: 'val2',
  param3: 'val3'

const setQuery = (key, value) => {
  let obj_url = new URL(window.location.href);
  let params = obj_url.searchParams;
  params.set(key, value);

for (let i = 0; i < Object.keys(obj).length; i++) {
  setQuery(Object.keys(obj)[i], Object.values(obj)[i])

I am expecting the request URL to be like


but i am getting