Recall & Review
beginner
What is the Fetch API used for in React Native?
The Fetch API is used to make network requests, such as getting data from a server, in React Native apps.
Click to reveal answer
beginner
How do you specify a GET request using Fetch API?
By default, Fetch makes a GET request if no method is specified, so you can simply call fetch(url) to perform a GET request.
Click to reveal answer
intermediate
What does the fetch() function return?
fetch() returns a Promise that resolves to a Response object representing the server's response.
Click to reveal answer
intermediate
How do you convert the response from fetch() to JSON?
You call the .json() method on the Response object, which returns a Promise that resolves to the parsed JSON data.
Click to reveal answer
beginner
Why should you handle errors when using fetch()?
Because network requests can fail due to no internet, server errors, or bad URLs, handling errors prevents app crashes and improves user experience.
Click to reveal answer
What is the default HTTP method used by fetch() if none is specified?
✗ Incorrect
fetch() uses GET by default to retrieve data from the server.
Which method converts the fetch response to JSON?
✗ Incorrect
The json() method parses the response body as JSON.
What does fetch() return?
✗ Incorrect
fetch() returns a Promise that resolves to a Response object.
Why is it important to handle errors when using fetch()?
✗ Incorrect
Handling errors helps manage network failures and keeps the app stable.
How do you make a GET request with fetch()?
✗ Incorrect
Simply calling fetch(url) makes a GET request by default.
Explain how to use the Fetch API to get data from a server in React Native.
Think about calling fetch, then using .then() to get JSON, and catching errors.
You got /5 concepts.
Describe why error handling is important when making GET requests with fetch.
Consider what happens if the internet is off or the server is down.
You got /4 concepts.