Question about API in React Native

Hello all,

I followed React Native Courses but i have a question about API call.
In Networking - Creating APi Layer/Fetching data, you have to call only 1 time to get all informations you need in to build the Card, but in my case, i have to do multiple call to get all informations and create “my card”. I don’t get how to do that ? I tried something but i’m stuck : can i do multiple api call in 1 Flatlist ? how can i store informations and then render them ?
I didn’t find any example showing that in the course and i’m not good enough to find the solution alone at the moment. Anyone can help ? thx

P.S : Im trying to do a react native application based on my wordpress website with wordpress api calls so i have multiple endpoint to call to retrieve all informations (post, media, taxonomy)

Here’s a repo with some good code for getting data into flatlist from a remote DB: iHateReadingLogs/TechLogsMobile/FlatlistInReactNative at main · shreyvijayvargiya/iHateReadingLogs · GitHub

I didn’t write the code, but I tried it out and it works well.

thanks dpickut, it provides, indeed, a partial answer to my question, since it’s not only an issue about making multiple call to an api rest endpoint, but it’s an issue about doing multiple call to differents endpoints.

I’m still looking for help on the Internet and found by my side something that helps me : https://youtu.be/fFNXWinbgro?t=1939, but i still have to study it since it’s not coded like Mosh’s code.

Anyone know why i can’t use componentDidMount() in function Card ?

i can’t use componentdidmount, because this is a class method and mosh doesn’t learn us to write code with class model but function model ?

Mosh is correct in his teaching. The React world seems to be moving away from class-based components.

Here’s a nice tutorial on applying the useEffect hook in functional components – it can basically do what componentDidMount does.
https://www.tutorialspoint.com/using-useeffect-in-react-js-functional-component