re: How to get data from an MySQL database in React Native VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I am trying to fetch the data from '/users' and display it in the homepage. fetch(){ fetch('http://localhost:3000/users') .then(respo...

You can't use localhost because you're running the app in your cellphone. The server is running on your computer. If you use locahost the app will understand that the server is running on your cellphone, which is not correct. Here's how you should do it:

async fetch(){ 
    await fetch('http://yourComputerIPhere:3000/users')
      .then(response => response.json())
      .then(output => (this.setState({output}))
    )} 
code of conduct - report abuse