API call using async/await
- Using promise
2. Using async/await
async onSearchSubmit(term) { const response = await axios .get('https://api.unsplash.com/search/photos', { params: { query: term }, headers: { Authorization: 'Client-ID
} })console.log(response.data.results);}
Reference :
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
- Modern React with Redux by Stephen Grider
I am blogging what I’ve learned to find later here for myself. If you happened to read this shit and there is wrong information, it would be appreciated to add a comment below.