Why is my external function automatically getting called on page load even though I didnt call it?
CodePudding user response:
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
}
CodePudding user response:
I exported my function with "export default funcName;" instead of using "export async function funcName() {...}"