Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

571
Views
How to solve the Network request failed error in react-native with expo?

I'm trying to fetch information from my local API with React-native and expo using the fetch method.

export function getBoardGamesFromApiWithSearchedText (text) {
    const url = 'http://localhost:2021/boardgame/list'

    return fetch(url)
        .then((response) => response.json())
        .catch((error) => console.error(error))
}

I have this error :

Network request failed at node_modules/whatwg-fetch/dist/fetch.umd.js:535:17 in setTimeout$argument_0

I saw that many people had this problem, apparently solved with the following solution: https://jsshowcase.com/question/react-native-fetch-https-localhost-network-request-failed

But I can't find the info.plist file maybe in the app.json but what should I configure?

I'm new to react native. Can someone help me on this ?

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs