Complete the code to import Axios in a React Native component.
import [1] from 'axios';
The Axios library is imported using the name axios by convention.
Complete the code to make a GET request to 'https://api.example.com/data' using Axios.
axios.[1]('https://api.example.com/data') .then(response => { console.log(response.data); });
To fetch data, use the get method of Axios.
Fix the error in the Axios POST request to send JSON data.
axios.post('https://api.example.com/data', [1]) .then(response => { console.log(response.data); });
Axios automatically converts JavaScript objects to JSON, so pass the object directly.
Fill both blanks to handle errors in an Axios GET request.
axios.get('https://api.example.com/data') .then(response => { console.log(response.data); }) .[1](error => { console.[2](error.message); });
Use catch to handle errors and console.log to print the error message.
Fill all three blanks to create an Axios instance with a base URL and timeout.
const api = axios.[1]({ baseURL: '[2]', [3]: 5000 });
Use axios.create to make an instance, set baseURL to the API address, and timeout to limit request time.
