Promises Flashcards

1
Q

What are the three states a Promise can be in?

A

pending, fulfilled, rejected

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

How do you handle the fulfillment of a Promise?

A

then() method of Promise.prototype

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

How do you handle the rejection of a Promise?

A

catch() method of Promise.prototype

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

What does fetch() return?

A

a promise

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

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

A

GET

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

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

A

create a request object and pass it in fetch as an argument

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

When does React call a component’s componentDidMount method?

A

after the first element is rendered

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

Name three React.Component lifecycle methods.

A

componentdidupdate, componentdidmount

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

How do you pass data to a child component?

A

using props

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