DEV Community

Discussion on: Better Pattern in fetching API data?

Collapse
 
bryceamcdaniel profile image
BryceAMcDaniel

Can you not do this?

useEffect(() => {
handleNewJokes();
}, []);

This should call the arrow function after your component has mounted.

Collapse
 
touhidulshawan profile image
Touhidul Shawan

Haha 😀. This was simple. Thank you. I always think of easy things in complicated way

Collapse
 
bryceamcdaniel profile image
BryceAMcDaniel

No problem! Good luck!