检索Api并呈现扁平化列表

时间:2019-07-26 08:42:19

标签: reactjs api react-native react-native-android

我已经在服务器:(http://lkcfesnotification.000webhostapp.com/api/notifications)上创建了自己的Api  当我检索它时,它仅在下面显示我的标题名称是我的代码

  _load() {
    let url = 'http://lkcfesnotification.000webhostapp.com/api/notifications';

    this.setState({isFetching: true});

    fetch(url)
    .then((response) => {
      if(!response.ok) {
        Alert.alert('Error', response.status.toString());
        throw Error('Error ' + response.status);
      }

      return response.json()
    })
    .then((members) => {
      this.setState({members});
      this.setState({isFetching: false});
    })
    .catch((error) => {
      console.log(error)
    });
  }

我的其余代码到期堆栈无法放入所有代码 https://imgur.com/a/8BVbpnk

0 个答案:

没有答案