Javascript 我试图使用unsplash api从unsplash获取一些信息,但我遇到了一个错误,有人能告诉我我做错了什么吗? 从“React”导入React 从“react native”导入{文本、视图、按钮、动画、样式表、维度、警报} 从“axios”导入axi

Javascript 我试图使用unsplash api从unsplash获取一些信息,但我遇到了一个错误,有人能告诉我我做错了什么吗? 从“React”导入React 从“react native”导入{文本、视图、按钮、动画、样式表、维度、警报} 从“axios”导入axi,javascript,reactjs,api,react-native,axios,Javascript,Reactjs,Api,React Native,Axios,我试图使用unsplash api从unsplash获取一些信息,但我遇到了一个错误,有人能告诉我我做错了什么吗? 从“React”导入React 从“react native”导入{文本、视图、按钮、动画、样式表、维度、警报} 从“axios”导入axios var{width,height}=Dimensions.get(“窗口”); 导出默认类App扩展React.Component{ componentDidMount(){ axios.get(“https://api.unsplash

我试图使用unsplash api从unsplash获取一些信息,但我遇到了一个错误,有人能告诉我我做错了什么吗?
从“React”导入React
从“react native”导入{文本、视图、按钮、动画、样式表、维度、警报}
从“axios”导入axios
var{width,height}=Dimensions.get(“窗口”);
导出默认类App扩展React.Component{
componentDidMount(){
axios.get(“https://api.unsplash.com/search/photos/?client_id=80e448841ff2a298408c349608b93aeafe65840c8266061e2c98f1ba3dc60456&query=flower")
.then(res=>Alert.Alert(res.data)).catch(error=>console.log(“erorr-present”))
}
render(){
返回(
你好
)
}               
}   

您遇到了什么错误?您遇到了什么错误?我在catch块中写的那一个我也检查了浏览器上的链接,它向我显示了数据,但在这里使用axios我无法获得它。这意味着您可以执行
catch(error=>console.log(“erorr present”,error))
并告诉我这些日志是什么?
import React from "react"
import {Text, View, Button, Animated, StyleSheet, Dimensions, Alert} from "react-native"
import axios from "axios"

var { width, height } = Dimensions.get("window") ;

export default class App extends React.Component{
  componentDidMount() {

     axios.get("https://api.unsplash.com/search/photos/?client_id=80e448841ff2a298408c349608b93aeafe65840c8266061e2c98f1ba3dc60456&query=flower")
       .then(res=>  Alert.alert(res.data)).catch(error=> console.log("erorr present"))        
  }

  render() {
    return(
      <View style = {styles.container}><Text>Hello</Text></View>
    )
  }               
}