I made API from where I am returning values and now am trying to take fetch those values and display in pie chart using reactjs but am not able to fetch.
class Graph extends Component {
ComponentWillMount(){
fetch('http://localhost:3010/analysis')
.then(response{response.json()})
.then(data => console.log(response))
}
render() {
return (
<ReactFC
{...pieConfigs}/>
);
}
}
export default Graph;
This is my code. Can anyone please tell me what are the changes I need to make to be able to display pie chart in react app?
componentDidMountand instead ofconsole.logset the data to state which can be used for chart configuration.