Why is my external function automatically getting called on page load even though I didnt call it?enter image description here
It looks like line 14 of fetchRandomUser.js is calling the function that you want to export. I would omit line 14 and change line 3 to
export default async function fetchRandomUser() {
// some code here
}
I exported my function with "export default funcName;" instead of using "export async function funcName() {...}"