我正在尝试使用unsplash api从unsplash获取一些信息,但出现错误,有人可以告诉我我在做什么错吗?

时间:2019-11-16 19:31:30

标签: javascript reactjs api react-native axios

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>
    )
  }               
}   

0 个答案:

没有答案