Axios Flashcards

1
Q

An axios instance is

A

a class returned from the axios.create() method that has access to put(), get(), post(), etc methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

An axios instance is useful for

A

changing one thing(instance baseURL) changes all places it is used, good for changes between production/development versions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create an axios instance

A

const instance = axios.create({baseURL: ‘https://some-domain.com/api/’});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Two advantage of axios vs fetch()

A

axios have more backwards compatibility;

axios automatically converts data being sent to json format;

axios can be instantiated;

its easier to set a timeout in axios;

axios can intercept requests or responses;

implementing progress bars for downloads is simpler in axios

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to modify the default baseURL of axios?

A

axios.defaults.baseURL = ‘url’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly