0

How can i fetch the categories in JSON url in ReactJs the url is https://s3.ap-south-1.amazonaws.com/scapic-others/json/models.json

1

1 Answer 1

2

There are many ajax call libraries that you can use. But the native way, which is supported in modern browsers is using fetch API. It will give you the json and you can process it according to your need. Here is the small example. As of now , due to cross origin I cannot replicate in the editor here. But the code goes like this

fetch("https://s3.ap-south-1.amazonaws.com/scapic-others/json/models.json")
    .then(res => res.json())
    .then(resultAns => { console.log(resultAns)})
Sign up to request clarification or add additional context in comments.

Comments

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.