0

I am extremely new to NodeJS and ReactJS coding so please bare with me, here is the code.

function App() {
  return <div className='app'>
    <button onClick={() => {
      fetch('http://localhost:8080/bitcoin')
        .then((res) => res.json())
        .then(console.log);
    }}>Display Data
    </button>
  </div>
}

My ReactJS website is trying to access my backend API, but I am getting a

Uncaught (in promise) TypeError: Failed to fetch

error

Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317

0 Answers0