[The code[
import logo from './logo.svg';
import './App.css';
import React, { Component, createContext, useState } from 'react';
import ReactDOM from 'react-dom'
class App extends Component {
state = {
players: []
};
async componentDidMount() {
const response = await fetch('http://localhost:8080/all');
const body = await response.json();
this.setState({ players: body });
}
render() {
const { players } = this.state;
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<div className="App-intro">
<h2>Players</h2>
{players.map(player =>
<div key={player.id}>
{player.name} ({player.foot})
</div>
)}
</div>
</header>
</div>
);
}
}
export default App;
]
The output on the site being fetched from is just json objects. I am not sure why nothing is outputting on the react app. I am very new to react and really don't know what I am doing.