TypeError: axios__WEBPACK_IMPORTED_MODULE_1___default.a.get(...).than is not a function
TypeError: axios__WEBPACK_IMPORTED_MODULE_1___default.a.get(...).than is not a function
我是 React redux 的新手,我收到类似“TypeError: axios__WEBPACK_IMPORTED_MODULE_1___default.a.get(...).than is not a function”之类的错误,请帮助这里是我正在使用的代码。
promise 链有错别字,应该是 then
而不是 than
,所以正确的实现应该是
componentDidMount() {
axios.get(`https://jsonplaceholder.typicode.com/posts`)
.then((response) => {
this.setState({ posts: response.data });
})
}
我是 React redux 的新手,我收到类似“TypeError: axios__WEBPACK_IMPORTED_MODULE_1___default.a.get(...).than is not a function”之类的错误,请帮助这里是我正在使用的代码。
promise 链有错别字,应该是 then
而不是 than
,所以正确的实现应该是
componentDidMount() {
axios.get(`https://jsonplaceholder.typicode.com/posts`)
.then((response) => {
this.setState({ posts: response.data });
})
}