click below
click below
Normal Size Small Size show me how
INTPROG - L9
Consuming API’s
| Question | Answer |
|---|---|
| API | Application Programming Interface |
| It is a set of rules and protocols that allows different software applications to communicate with each other | API |
| An Open-Source JavaScript Library used to make HTTP requests from web browser | Axios |
| What is Promise? | Compose of .then and .catch |
| An object that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. | Promise |
| handle the successful response | .then() |
| handle the errors | .catch() |
| .then() | .then ((response) => { console.log(response) }) |
| .catch() | .catch((error) => { console.log(error) }) |
| allows you to perform side effects in your functional components. It runs after the component renders and can be configured to run only when certain dependencies change. | useEffect |
| Import useEffect on component. | import { useEffect } from "react"; |
| Setup of useEffect | useEffect ((( ) => {}, [] ) |
| Checker value/ what the useEffect monitor | [ ] |
| Instruction to Execute | ( ) => { } |