回答編集履歴
2
did
answer
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
this.state = { data: [] };
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
componentDidMount() {
|
36
36
|
axios
|
37
37
|
.get('https://jsonplaceholder.typicode.com/posts')
|
38
38
|
.then((result) => {
|
1
a
answer
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
-
[axios
|
1
|
+
[axios](https://github.com/axios/axios)ライブラリを自分の場合は使っています。
|
2
2
|
|
3
|
+
> Promise based HTTP client for the browser and node.js
|
4
|
+
|
5
|
+
> Features
|
6
|
+
> - Make XMLHttpRequests from the browser
|
7
|
+
> - Make http requests from node.js
|
8
|
+
> - Supports the Promise API
|
9
|
+
> - Intercept request and response
|
10
|
+
> - Transform request and response data
|
11
|
+
> - Cancel requests
|
12
|
+
> - Automatic transforms for JSON data
|
13
|
+
> - Client side support for protecting against XSRF
|
14
|
+
|
3
15
|
質問文に掲載されているコードを見ると、reactのようだったので、
|
4
16
|
以下、reactでのサンプルコードです。
|
5
17
|
|