Skip to content

Commit a265294

Browse files
committed
readme
1 parent e91216b commit a265294

File tree

1 file changed

+14
-0
lines changed
  • lessons/03-request-response/lecture

1 file changed

+14
-0
lines changed

lessons/03-request-response/lecture/NOTES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ new Request('url')
77
new Response()
88
```
99

10+
## Request
11+
1012
These are the foundations of what `fetch` operates on.
1113

1214
```js
@@ -16,3 +18,15 @@ fetch('site.com')
1618
const req = new Request('site.com')
1719
fetch(req)
1820
```
21+
22+
## Response
23+
24+
`fetch` returns a promise that "resolves" an instance of Response:
25+
26+
https://developer.mozilla.org/en-US/docs/Web/API/fetch#return_value
27+
28+
If the response contains JSON data, you can resolve that from the response object:
29+
30+
```js
31+
fetch().then((res) => res.json())
32+
```

0 commit comments

Comments
 (0)