Promises Flashcards
What are the three states a Promise can be in?
pending, fulfilled, rejected
How do you handle the fulfillment of a Promise?
then() method of Promise.prototype
How do you handle the rejection of a Promise?
catch() method of Promise.prototype
What does fetch() return?
a promise
What is the default request method used by fetch()?
GET
How do you specify the request method (GET, POST, etc.) when calling fetch?
create a request object and pass it in fetch as an argument
When does React call a component’s componentDidMount method?
after the first element is rendered
Name three React.Component lifecycle methods.
componentdidupdate, componentdidmount
How do you pass data to a child component?
using props