In the frontend/src/
directory, modify App.js
to call the Flask API and display the message:
import React, { useEffect, useState } from 'react';
import axios from 'axios';
function App() {
const [message, setMessage] = useState('');
useEffect(() => {
// Fetch data from the Flask API
axios.get('http://127.0.0.1:5000/')
.then(response => setMessage(response.data.message))
.catch(error => console.log(error));
}, []);
return (
<div className="App">
<h1>{message}</h1>
</div>
);
}
export default App;