React native flatlist 2 api data use | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

React native flatlist 2 api data use

How to use 2api data in one flafList ? One api data - name and price Second api data - images array How to combine??

14th Oct 2020, 11:52 AM
Arjit Sing
Arjit Sing - avatar
1 Answer
+ 1
The FlatList is not the issue here. Assuming you want to do some kind of merge between the data returning from the APIs, you need to first make the call to BOTH APIs, wait for the all results and then merge the data. Yoy can use Promise.all(...) to wait for all promises to be resolved. These links may help https://stackoverflow.com/a/57205276 https://youtu.be/Mt3kxUvHORA https://medium.com/@dev.ankursehdev/multiple-api-calls-in-react-using-axios-with-loading-and-error-handling-ae8584937b7c
16th Oct 2020, 12:44 PM
Burey
Burey - avatar