2
I’m taking a course of React Active, but since my computer didn’t run Genymotion, I had to improvise and downloaded Bluestacks to debug the projects. The problem is that when my program requests from the internet, it always returns me Network Error. I am using the.
I’ve searched everywhere I can think of, but I can’t find anything to solve this problem.
Edit: had forgotten to put the code
main.js:
import React, { Component } from 'react';
import api from '../services/api';
import { View, Text } from 'react-native';
export default class Main extends Component {
static navigationOptions = {
title: 'JSHunt'
};
componentDidMount() {
this.loadProducts();
}
loadProducts = async () => {
const response = await api.get('/products');
//const { docs } = response.data;
//console.log(docs);
};
render() {
return (
<View>
<Text>Página Main</Text>
</View>
);
}
}
api.js
import axios from 'axios';
const api = axios.create({
baseUrl: 'https://rocketseat-node.herokuapp.com/api'
});
export default api;
And where is the code in which you use the AXIOS? By the error message hints that an exception is being thrown and you are not capturing it, but you can not know without your code.
– Andre
I forgot to put the code, now I edited it. Thanks for the touch!
– feehgodoi08