reinvest/frontend/src/components/Portfolio.js
2021-01-30 15:45:46 -05:00

28 lines
649 B
JavaScript

import React, { Component } from "react";
import "./assets/Portfolio.css";
class Portfolio extends Component {
constructor(props) {
super(props);
this.state = { apiResponse: "" };
}
callAPI() {
fetch("http://localhost:9000/FETCHURL")
.then((res) => res.text())
.then((res) => this.setState()({ apiresponse: res }))
.catch((err) => err);
}
componentDidMount() {
this.callAPI();
}
render() {
return (
<div class="container">
<h1 class="d-flex justify-content-center m-2 p-4">Portfolio</h1>
<h1>{this.state.apiResponse}</h1>
</div>
);
}
}
export default Portfolio;