在console.log中收到错误
[14:02:02] [未处理的承诺被拒绝:错误:网络错误] -createError中的node_modules \ axios \ lib \ core \ createError.js:16:24 -handleError中的node_modules \ axios \ lib \ adapters \ xhr.js:87:25 -... 9个来自框架内部的堆栈框架
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import axios from 'axios';
import PhotoSection from './photo-section';
//functional is just returning some data - static
//smart component for dynamic class component
export default class PhotoFeed extends Component {
render() {
axios.get('http://127.0.0.1:3000/photos')
.then(response=> console.log(response));
return (
<View>
<Text> textInComponent </Text>
</View>
);
}
}