Запрос Axios в React Native - PullRequest
       24

Запрос Axios в React Native

0 голосов
/ 03 марта 2019

Я не могу понять, что означают эти ошибки.

Это мой компонент:

import React, { Component } from 'react';
import { Text, View } from 'react-native';
import axios from 'axios';

class AlbumList extends Component {

 componentWillMount() {
 axios.get('https://rallycoding.herokuapp.com/api/music_albums')
 .then(response => console.log(response));
 }
 render() {
   return (
    <View>
     <Text>AlbumList!</Text>
    </View>
);
 }
}
 export default AlbumList;

Это мои ошибки:

enter image description here

@ deltaUrlToBlobUrl.js: 29 Показать:

enter image description here

(индекс): 185 показать (я добавил ";", но непомощь):

enter image description here

1 Ответ

0 голосов
/ 03 марта 2019

Попробуйте вызвать ваш запрос API в componentDidMount ().Ваша конечная точка API работает нормально.здесь прикреплен снимок экрана с желаемым решением.

enter image description here

...