Reputation: 27
Why is my external function automatically getting called on page load even though I didnt call it?enter image description here
Upvotes: 0
Views: 22
Reputation: 27
I exported my function with "export default funcName;" instead of using "export async function funcName() {...}"
Upvotes: 0
Reputation: 344
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
}
Upvotes: 1