0

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.

1
  • 1
    React has nothing to do with fetch calls Commented Feb 20, 2018 at 14:10

1 Answer 1

1

You can use bluebirds Promise.all. Documentation. This will wait for any number of calls to finish before providing a response object.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank You I got it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.