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', {
                method:'Get',
            })
            .then(data=> {
             return   data.json()
            })
           
}

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

Answer

component file

let getFetch = async () => {
   const url = "https://jsonplaceholder.typicode.com/todos";
   let res = await getRequestData(url);
   console.log(res)
}
getFetch();

service.js

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;