App.js
735 Bytes
import logo from './logo.svg';
import './App.css';
import axios from "axios";
import { useEffect } from 'react';
function App() {
const callApi = async()=>{
axios.get("/api").then((res)=>{console.log(res.data.test)});
};
useEffect(()=>{
callApi();
}, []);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;