fetch Flashcards

1
Q

What does fetch( ) return?

A

returns a promise and

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

What is the default request method used by fetch( )?

A

‘get’ request method

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

How do you specify the request method (GET, POST, etc.) when calling ‘fetch’?

A

you pass a second parameter the options method

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

How does ‘fetch’ report errors?

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

How can useEffect be used to load data for a component?

A

yes by using a fetch

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

What browser function can be used to make HTTP requests to a server in React?

A

fetch

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

How do you use useEffect to load component data just once when the component mounts?

A

you pass in an empty array for the dependencies

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

How do you use useEffect to load component data every time the data key changes?

A

you pass it into the dependencies array

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

In a large-scale production app, what are some better alternatives for loading and managing backend data?

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