how to set header in react native api call code example

Example: how to sent get on react native

export const getNetworkImageBase64Format = () => {
  // eslint-disable-next-line no-undef
  const oReq = new XMLHttpRequest();
  oReq.open('GET', url);
  oReq.responseType = 'arraybuffer';

  // Process the response when the request is ready.
  oReq.onload = () => {
    if (oReq.status === 200) {
      // console.log('response', this.response);
      const base64 = Buffer.from(oReq.response).toString('base64');
      console.log('base64', base64);
      return base64;
    }
    return null;
  };
  oReq.send();
};