How can i seperate my fetch request to another file in react js

am using react and trying access the promise object which is defined in one file (service file) from another file (class component) .but when am importing the getData to another file ,it gives me undefined. Can someone help me out in this.

service.js file
export const getData=()=>{
    fetch('url', {
            .then(data=> {
             return   data.json()

component file 
import {getData} from '../Service'
console.log(getData()) //gives undefine


component file

let getFetch = async () => {
   const url = "";
   let res = await getRequestData(url);


const getRequestData = async (url) => {
    let resData = await fetch(url)
                        .then( res => res.json() )
                        .then( async (result) => {
                                                    return result
                                                } ,
                                    (error) => { 
                                                return error 
    return resData;

export default getRequestData;