make API call
How to make HTTP request
AJAX
jQuery
Fetch
Axios
Fetch
A Fetch API provides a fetch method defined on a window object, which you can use to perform requests and sent it to the server. This method returns a Promise that you can use to retrieve the response of the request.
fetch('https://api.mydomain.com').
then(response => response.json()).
then(data => this.setState({ data }));fetch('http://example.com/movies.json')
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(myJson);
});Fetching data from the server

AJAX
Axios
Last updated
Was this helpful?