teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

did

2018/03/14 02:23

投稿

HayatoKamono
HayatoKamono

スコア2415

answer CHANGED
@@ -32,7 +32,7 @@
32
32
  this.state = { data: [] };
33
33
  }
34
34
 
35
- componentWillMount() {
35
+ componentDidMount() {
36
36
  axios
37
37
  .get('https://jsonplaceholder.typicode.com/posts')
38
38
  .then((result) => {

1

a

2018/03/14 02:23

投稿

HayatoKamono
HayatoKamono

スコア2415

answer CHANGED
@@ -1,5 +1,17 @@
1
- [axiosライブラリ](https://github.com/axios/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