I have 3 API endpoints and I have made a search box where user inputs search term. After typing in the search term in search box all the data from API endpoint should return it.
API endpoints:
localhost:5000/mydata1/search/q="searchterm"
localhost:5000/mydata2/search/q="searchterm
localhost:5000/mydata3/search/q="searchterm"
Now above our 3 API endpoints. When I type in some search term in search box it should display all the data from API endpoints. As I am new to ReactJS I want to ask to get the data (JSON response) from API endpoints do I need to call fetch()
on each URL's to get the data or is there some other efficient way to do it.
You can use bluebirds Promise.all. Documentation . This will wait for any number of calls to finish before providing a response object.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.