1 |
npm i axios --save |
örnek json çıktı linki;
https://jsonplaceholder.typicode.com/photos
get örneği;
1 2 3 4 5 6 7 8 |
componentDidMount() { axios.get("https://jsonplaceholder.typicode.com/photos") .then((res)=>{ console.log(res); console.log("asd"); }) .catch((e)=>console.log(e)); } |
post örneği
1 2 3 4 5 6 7 8 9 |
axios.post("https://jsonplaceholder.typicode.com/photos",{ username:'c', 'password':'123' }) .then((res)=>{ console.log(res); }) .catch((e)=>console.log(e)); |