Axios Is used For Api Calling in React-native ...
Step 1. npm install axios;
After installing package.
import axios from "axios";
const options = {
method:method // post or get
headers:{'content-type':'application/json'},
data:data,
url:"Apiurl",
};
axios(options).then(res => {
//Do something
}
Note If u Want to Send Form-data then
change Content-type to multiformdata
and pass formdata in data field in Options
change Content-type to multiformdata
and pass formdata in data field in Options
Comments
Post a Comment